Skip to content

How to send my own product id for update records #195

Open

Description

@4moradi

Hi
I want to thanks for sharing this script with us, I used this editable table for my products, I want to update price of each product, but this program will send rowIndex as the product id, how can i send product_id instead of rowIndex?

Thanks in advance

Activity

  1. crivadavi commented on Nov 3, 2018

    @crivadavi

    Use the method getRowId(index) available on editablegrid

  2. 4moradi commented on Nov 18, 2018

    @4moradi
    Author

    Hi, I do not know how can I Thanks for your answer, I added this
    id: editableGrid.getRowId(index),
    in the updateCellValue function, but I get the following error:
    ReferenceError: index is not defined[Learn More]

  3. 4moradi commented on Nov 18, 2018

    @4moradi
    Author
  4. 4moradi commented on Nov 19, 2018

    @4moradi
    Author

    Would you please help me?

  5. crivadavi commented on Nov 19, 2018

    @crivadavi

    in your method

    function updateCellValue(editableGrid, rowIndex, columnIndex, oldValue, newValue, row, onResponse) {

    the variable rowIndex represent what you have to use to get the id so, write this:

    id: editableGrid.getRowId(rowIndex)

  6. 4moradi commented on Nov 19, 2018

    @4moradi
    Author

    Thanks a lot but this will post the row id that starts from 1, not my product id in my product table, so i can not update product table, I want to post product id from each product as a row
    for example I will update first product's price, so when i change the price, these data will be post:
    `

    colname price
    coltype integer
    id 1
    newvalue 2222
    oldvalue 1460
    tablename demo

    `

    as you see the id is 1 but the ID of that product is 52, I should send 52 as id not row index or row id that is 1.

    thanks a lot for your help

  7. crivadavi commented on Nov 19, 2018

    @crivadavi

    I see that from your php method you return a json like this

    {
        "metadata" : [...],
        "paginator" : [...],
         "data" : [
              {
                  id : null,
                  values : [52, ...]
              },
              {
                  id : null,
                  values : [53, ...]
              }, ...
          ]
    }

    You have to set the id in the "id" property of the object in the array too like this:

    {
         "data" : [
              {
                  id : 52,
                  values : [52, ...]
              },
              {
                  id : 53,
                  values : [53, ...]
              }, ...
    }
  8. 4moradi commented on Nov 20, 2018

    @4moradi
    Author

    Thanks Thanks a lot,
    About this:

    You have to set the id in the "id" property of the object in the array

    How can I do this? I do not understand exactly that where i should make changes, which file?
    Would you please help me more?
    May i send you my ftp account? would you please send me your email address to send ftp information?

  9. 4moradi commented on Nov 20, 2018

    @4moradi
    Author

    That problem solved by your kindly help, but now it seems that responsive or mobile friendly does not work
    Thanks in advance
    you are great

  10. paashukhan commented on Jan 23, 2019

    @paashukhan

    id: editableGrid.getValueAt(rowIndex,0) you can select column index for value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions