3.2.0

Get the template type (checkbox, combo, etc.) for a column/cell

Ok, I had this working a few weeks ago, shelved the code (didn't end up needing it at the time) and then brought it back for use elsewhere. Now I can't get it to work.

What I want to do is dynamically determine what kind of cell (combo, checkbox, etctera) I am working with. The code that used to work is:

obj.onCellSelectedChanged = function(event){
var col = this.getCurrentColumn();
var row = this.getCurrentRow();
window.alert(obj.getCellTemplate(parseInt(col), parseInt(row)).element().getAttribute("awx"));
}

This used to pop up the word "combo" for a combobox. Now it pops up "null"

I'm basically looking for a way to dynamically determine if the current cell being edited is a checkbox...
andrewzoo
January 9,
I couldn't figure out why my previously posted code stopped working, however, I did find out a way to dynamically get the template type for a cell (in my example below, "obj" is the name of my grid object):

var col = this.getCurrentColumn();
var row = this.getCurrentRow();
window.alert(obj.getCellTemplate(parseInt(col), parseInt(row)).getClass("templates"));

This returns the string "cell" for any cell in the grid that is using the default template. For checkboxes, it returns "checkbox," and for comboboxes, returns "combo."

Only took me two hours to figure out. I'm getting better at this, Alex... :)
andrewzoo
January 9,
You can also use 'constructor' property to compare -

alert(obj.getCellTemplate(col, row).constructor == AW.Templates.Checkbox);



Alex (ActiveWidgets)
January 10,

This topic is archived.

See also:


Back to support forum