开发者

Extjs to get all checkbox having id as abcd_xyz_2_*?

I have list of check box as:

test1 test2 test3

is it possible to get all the checkbox having name "abcd_xyz_2_*" thru extjs. so that i can make 开发者_开发百科them checked or unchecked

THanks All


If you know the exact names of the fields you want to check then you can do so with a single call to the containing form's setValues method.

Assuming the checkboxes are in an Ext.form.FormPanel instance named 'form':

form.getForm().setValues({
    test1: true,
    test2: true,
    test3: true
});

If you still need to set by ID prefix then you can do something like:

form.items.each(function( item ) {
    if ( item.getId().indexOf('abcd_xyz_2_') === 0 ) {
        item.setValue(true);
    }
});

To manipulate generic checkbox elements in the page which are not contained in any ExtJS panels you can use Ext.query:

Ext.each(Ext.query('input[id^=abcd_xyz_2_]'), function( item ) {
    item.checked = true;
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜