But I’ve no luck updating the column names other than directly / manually editing the DataTable initialization code inside of the ‘index.html’ file within the project folder… not ideal.
I should add this, I add data to the table after I fire the column update attempts. The data gets added to the table but the Column names retain the same names as they were initialized with. My attempts to set new values are simply ignored.
Does anyone know how I can edit / update the columns at runtime?
As a side, once this is solved, it would make the greatest of sense to add a ‘Columns’ property to the component to simplify this. I mean the columns are almost as frequently used as the ‘value’ or ‘text’ property on a text box.
Datatables is a powerful control - you can do almost anything with it. The definitive documentation (and support) for it is available on the developer’s website.
Yes thats true there are examples on their website. Also I could not get them to function within NSB.
I think I have it solved though, I’m a little short on time. I ditched using the datatable and just switched to using the jqWidgets Listbox which easily accepted JSON formatted data (at runtime even!) and displays the results instantly with one line of code. No fancy columns but I need functional right now, I can work on ‘pretty’ later.
Sorry, I posted too soon, this is the updated (fixed) code that actually works for me. This code is for the BASIC language version of the jqWidgets Listbox. In this example, I feed in a raw string (which could come from an AJAX response or whatever) and then convert it to a JSON object, then insert it into the Listbox. The refresh happens immediately afterward.
Items of note:
The way you access the Listbox in code is inconsistent vs the usual BASIC methods but it works just fine.
Also accessing the listbox objects own “lstTest.source” property at runtime doesn’t appear to do anything however it does work to set an Initial value (at design-time). Only the method below appears to work at runtime.
This is a compiled APK test. I did not test this as a Webapp or on iOS.
'// Listbox object is named lstTest
strSourceRaw = "[""10/21/2024 12:56 PM CHARGE $500.00"", ""10/21/2024 04:56 PM REFUND $430.00""]"
strSourceJSON = JSON.parse(strSourceRaw) '// Convert to JSON object
$("#lstTest").jqxListBox({source: strSourceJSON}) '// This triggers refresh of the listbox named lstTest