question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

row.update() doesn't seem to update child/sub values

See original GitHub issue

I think I have found a small(ish) bug to do with how row.update(JSON) doesn’t update children/sub values.

I’m grabbing (quite happily via AJAX) a JSON in the style of:

[{"ID":1,
  "clientID":89,
  "client":  { 
     "ID":89,
    "clientName":"ABC (Test Client)",
    "clientAddress":null
  },
  "jobName":"Test Joby",
  "jobAddress":"Example\r\ny",
  "jobDetails":"etc etc etc"
},
{"ID":2,
  "clientID":89,
  "client":  { 
     "ID":89,
    "clientName":"ABC (Test Client)",
    "clientAddress":null
  },
  "jobName":"This is test",
  "jobAddress":"123 Fake Street",
  "jobDetails":"etc etc etc"
},
{"ID":3,
  "clientID":89,
  "client":  { 
     "ID":89,
    "clientName":"ABC (Test Client)",
    "clientAddress":null
  },
  "jobName":"Is ABC (89) but to change",
  "jobAddress":"Please Enter Job Address..",
  "jobDetails":"etc etc etc"
}]

Which is JSON serialized from two objects classes in PHP without any issues. Initial load is perfect (and any manual refresh with table.replaceData(‘AJAX.php’) calls etc). But when I use row.update(myXMLHttpRequest.responseText) only the top level (ID, jobName, jobAddress, & jobDetails) update in the grid leaving the child ones unchanged (client.ID, client.clientName, & client.clientAddress) displaying the old values.

myXMLHttpRequest.responseText being something akin to:

{"ID":3,
  "clientID":81,
  "client":  { 
     "ID":81,
    "clientName":"Test Client",
    "clientAddress":null
  },
  "jobName":"Was ABC (89) now another",
  "jobAddress":"Please Enter Job Address..",
  "jobDetails":"etc etc etc"
}

I know the underlying row object has replaced the values with the new one (I’ve console logged the row and shows correctly updated JSON including client sub JSON) but not updated the cells that display that data. If I resort the columns (any column) it does update.

Using Tabulator v4.2.7 (latest)

Table columns (abridged for clarity)

            {title:"ID", field:"ID", visible:false},
            {title:"Job Name", field:"jobName", editor:"input", validator:["required", "maxLength:32"]},
            {title:"Client", field:"client.clientName"},
            {title:"ClientID", field:"clientID", visible:true},
            {title:"Client.ID", field:"client.ID", visible:true},
            {title:"Job Address", field:"jobAddress", editor:"textarea", validator:"required", formatter:"textarea"},

image

In screenshot the third entry’s client has been changed from “ABC (Test Cient)” to “Test Client”. While the clientID cell has updated the client.clientName and client.ID cells haven’t - despite the JSON having changed.

Tested on

  • OS: Win 10
  • Browser: Chrome
  • Version: 74

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
aklavercommented, May 14, 2019

Sounds like a good idea to me. That would be an Oli answer though.

1reaction
aklavercommented, May 14, 2019

What happens if you do a table.redraw() or table.redraw(true) after the row.update()?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Update Parent Rows after Child Row Updated - Telerik
I have a project where in a RadGrid the Master Table rows contain template columns that display totals based values in the Child...
Read more >
Updating cell data doesn't update visible responsive child cells.
I just wanted to report a bug with Responsive Datatables. If you update a cell data as follows; $('#my-datatable').DataTable().cell(RowSelector, ...
Read more >
Database not updating new row - sql - Stack Overflow
I am binding the DGV to a table. It seems like maybe I need a dataset somewhere to update but I cannot figure...
Read more >
Problem getting array values to update in table - PHP - SitePoint
I'm trying to get some array data to update via a form and for some reason, although it doesn't throw an error, it...
Read more >
why an update doesn't update a row if the where clause exists?
I have a stored procedure to update a row, and it works fine most of ... actual current value in the table so...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found