简体   繁体   中英

tabulator save history in a dictionary

I'm trying to save all changes made to each cell in tabulator in a list or a directory .

I've turned history feature on history:true,

i've checked the "history callback" documentation in this link http://tabulator.info/docs/4.1/callbacks#history and i know how to get the old and new value now but i didn't find any details about cell ID or how am i suppose to get the position or location of the changed cell

The cell component passed into any of the callbacks like cellEdited gives you access to the cell directly.

It can also give you access to row and column information too.

For example you can get the field that the cell relates to by calling the getField function on the component, you can access the column component which will give you access to all sorts of useful column related info

cellEdited:function(cell){
    //cell - cell component

   var field = cell.getField();
   var column = cell.getColumn();
},

if you want to know which row was edited then you can use the getData function on the cell component to return the rows data object, then lookup whatever unique identifying field you have setup (for example an id field if you have set one). you can also get the row component by using the getRow function which will give you access to all sorts of useful row related info including the getPosition function which will tell you the vertical position of the row in the table.

cellEdited:function(cell){
    //cell - cell component

   var id = cell.getData().id;
   var row = cell.getRow();
   var position = row.getPosition();
},

Have a look at the Component Objects Documentation for full details

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