Cell ID and saving to database

Tags: #<Tag:0x00007f8b2b1bd8f8>

Hello, each cell in my table is a record in my database each with its own unique ID. Is it possible to store the unique ID as an attribute of the cell?

My objective is to use the cell ID to update the database such as:

UPDATE forecast SET quantity=newQuanitity WHERE _ID = Cell_ID

Thank you in advance for any help.

Hi @erol

You can use cell metadata to store a unique ID. Here is an example of how to work with metadata https://jsfiddle.net/handsoncode/tb7rw0xk/

@aleksandra_budnik - thank you very much for the quick reply. Much appreciated! Will this solution scale for larger tables with > 300 cells? Are there any performance issues I should be aware of?

Thanks again!

-Erol

the setCellMeta does not trigger cell renderer() so it should not affect the performance.

If you want to hold some visuals in cell meta (for example a className thats paints the cell blue) then you need to manually call the render() method to reflect the changes in the table.

Thanks a ton for your help. Have another quick question - what is the difference between setCellMeta and setCellMetaObject?

The setCellMeta attaches one metadata at once and by the setCellMetaObject you call pass more metadata at once. Here is an example https://jsfiddle.net/zm7h2g6c/7/