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

This commit is contained in:
Ralf Becker 2015-05-02 10:43:14 +00:00
parent 1f6c2e0de0
commit 562cdc409e
3 changed files with 36 additions and 2 deletions

View File

@ -1941,7 +1941,7 @@ var et2_nextmatch = et2_DOMWidget.extend([et2_IResizeable, et2_IInput, et2_IPrin
var nm = this;
var dialog = et2_dialog.show_dialog(
// Abort the long task if they canceled the data load
function() {count = total; cancel=true;window.setTimeout(function() {defer.reject();},0)},
function() {count = total; cancel=true;window.setTimeout(function() {defer.reject();},0);},
egw.lang('Loading'), egw.lang('please wait...'),{},[
{"button_id": et2_dialog.CANCEL_BUTTON,"text": 'cancel',id: 'dialog[cancel]',image: 'cancel'}
]
@ -2025,7 +2025,7 @@ var et2_nextmatch = et2_DOMWidget.extend([et2_IResizeable, et2_IInput, et2_IPrin
{"button_id": 1,"text": egw.lang('Ok'), id: 'dialog[ok]', image: 'check', "default":true},
// Nice for small lists, kills server for large lists
//{"button_id": 2,"text": egw.lang('All'), id: 'dialog[all]', image: ''},
{"button_id": 0,"text": egw.lang('Cancel'), id: 'dialog[cancel]', image: 'cancel'},
{"button_id": 0,"text": egw.lang('Cancel'), id: 'dialog[cancel]', image: 'cancel'}
]
);
return defer;

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

@ -1067,6 +1067,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"]);