allow to iterate over grids and set checkboxes readonly (disabled)

This commit is contained in:
Ralf Becker 2015-05-02 10:42:53 +00:00
parent bdf5c436dd
commit 0ea5195f2e
2 changed files with 34 additions and 0 deletions

View File

@ -105,6 +105,16 @@ var et2_checkbox = et2_inputWidget.extend(
}
},
/**
* Disable checkbox on runtime
*
* @param {boolean} _ro
*/
set_readonly: function(_ro)
{
jQuery(this.getDOMNode()).attr('disabled', _ro);
},
/**
* Override default to return unchecked value
*/

View File

@ -1068,6 +1068,30 @@ var et2_grid = et2_DOMWidget.extend([et2_IDetachedDOM, et2_IAligned, et2_IResize
}
}
}
},
/**
* Function which allows iterating over the complete widget tree.
*
* @param _callback is the function which should be called for each widget
* @param _context is the context in which the function should be executed
* @param _type is an optional parameter which specifies a class/interface
* the elements have to be instanceOf.
*/
iterateOver: function(_callback, _context, _type)
{
if (!this.cells) return;
for(var r=0; r < this.cells.length; ++r)
{
var row = this.cells[r];
for(var c=0; c < row.length; ++c)
{
if (!row[c].widget) continue;
row[c].widget.iterateOver(_callback, _context, _type);
}
}
}
});
et2_register_widget(et2_grid, ["grid"]);