Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #109287

    In a “standard” html table if I want an editable cell I put an <input> between <td> and </td> and everything in a form, then I can get the value of the <input> as in every other form field in html.

    If I use a <smart-table> with some editable cells how can I get back values when values are submitted to the server ?

    Tks

     

    #109291
    ivanpeevski
    Participant

    Hi,

    If you need the value of only some specific cells, you can use getValue in this way:

    const val= table.getValue(“3, ‘lastName'”);

     

    Best Regards,
    Ivan Peevski
    Smart UI Team
    https://www.htmlelements.com/

    #109295

    I need back value of all modified cells with some id to distinguish them.

    In your example I don’t understand where can I get the value on the server : const val is a javascript variable not a server one.

    Tks

    #109297
    ivanpeevski
    Participant

    Hi,

    Here is a more detailed guide how to achieve that:

     

    For unique cell ids you can use the combination of row index + cell datafield. So a cell id will be like “2_lastName”

     

    You can use the cellEndEdit event to keep track of cells that have been edited by storing their id in a global array.

     

    Use the browser’s “submit” and “formdata” events to modify the form data before it gets to the server, like in the documentation here:
    https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/formdata_event

     

    Use the getValue method I suggested to get the current cell value and add the cell id + value to the modified FormData object.

     

    Best Regards,
    Ivan Peevski
    Smart UI Team
    https://www.htmlelements.com/

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.