How do I check if a Kendo Grid has had changes made to it?

前端 未结 6 941
我在风中等你
我在风中等你 2021-02-12 10:58

How can I check if a Kendo Grid has changes? I heard that there is a dirty property, but I cant find it.

6条回答
  •  时光说笑
    2021-02-12 12:03

    You can get notified and use the change event of the dataSource which will occur wherever you page/sort/group/filter/create/read/update/delete record.

    To attach a handler to it use:

    $('#YourGrid').data().kendoGrid.dataSource.bind('change',function(e){
        //the event argument here will indicate what action just happned
        console.log(e.action)// could be => "itemchange","add" or "remove" if you made any changes to the items
    })
    

    Update: If the user has updated any of the models .hasChanges() method of the dataSource will return true.

提交回复
热议问题