ce icon indicating copy to clipboard operation
ce copied to clipboard

Get changed rows only.

Open lyassa opened this issue 6 years ago • 4 comments

Is there a way to get the Json only of the rows that changed? For example:

  • table.getData(false) gets ALL the rows
  • table.getData(true) gets the selected rows

How about table.getModifiedData()

lyassa avatar Dec 05 '19 00:12 lyassa

table.getJson(true) // for hightlighted cells table.getJson(false) // all cells

pphod avatar Dec 05 '19 15:12 pphod

Thanks Paul. Actually I meant to return only modified rows not all rows nor highlighted rows. This is useful in case a table has, say few hundred rows, and the user modify data in two rows only. Upon submitting the form, I want to be able to identify only these two rows to write them back to the database. I think I can track that using metadata, however it will be awesome if JExcel make that available without extra coding on the developer side.

lyassa avatar Dec 05 '19 16:12 lyassa

Lyassa, you should use an event such as onafterchanges for example. This events can help you to keep frontend and backend syncronized.

pphod avatar Dec 07 '19 11:12 pphod

https://bossanova.uk/jspreadsheet/v4/examples/events, look it see. var selectionActive = function(instance, x1, y1, x2, y2, origin) { // console.log(y1,y2) console.log(table.getRowData(y1))//get active row datas (y1 is first:0),then mondify myTable.setRowData(y1, ['1',,'2',.....]); //myTable.setValue([string], [string], [bool]); only mondify cell var cellName1 = jspreadsheet.getColumnNameFromId([x1, y1]); var cellName2 = jspreadsheet.getColumnNameFromId([x2, y2]); $('#log').append('The selection from ' + cellName1 + ' to ' + cellName2 + ''); }

itmeicn avatar Sep 04 '23 09:09 itmeicn