简体   繁体   中英

How to create datasource with observable model?

I have the grid with checkboxes with local data source.

I would like checked\\uncheked a row (without visual effect) and I would like save state checkboxes for pager.

example: If I uncheck first record on first page and will go to second page and return to first page first record MUST BE uncheck.

How to do this?

I trying

 var gridModel = kendo.observable({
        gridData: dataSource
    });
kendo.bind($("#chart"),gridModel);

http://jsfiddle.net/dude_jsfiddle/Pf3TQ/25/

Bindings are not supported inside of the client template - you can only use client expressions like #= #, #: #, # #.

Basically what you are looking for is discussed in a code library. Anyway I updated the JsBin with extra logic that demonstrates what you search for:

 template: '<input type="checkbox" #= IsSelected ? "checked" : ""#  "></input>',

And the most vital logic that actually updates the underlying model:

grid.tbody.on('click',':checkbox',function(){
    var tr = $(this).closest('tr');
    grid.dataItem(tr).set('IsSelected',$(this).is(':checked'));
});

JsFiddle here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM