BS4 Datatable problems

I’ve gone through the sample file for Datatables (BS4 in BASIC) and am getting nowhere. I’ve made an extremely cut down version of the original sample and can not for the life of me work out why it won’t show my new column names and my data.

Any help appreciated.

    var data1 = [
        ["1", "John", "2000", "100"],
        ["2", "Shane", "1000", "99"],
        ["3", "Andrew", "500", "98"]
    var dataJson = JSON.stringify(data1);
    var columns1 = [
        {title: "RANK"},
        {title: "PLAYER"},
        {title: "SCORE"},
        {title: "PTS"}

End JavaScript

Function Button1_onclick()
    dt.settings.columns = columns1 = data1
End Function

dt is the name of my datatable
I’ve just added a Button which I was hoping would change the datatable and put my data in it, but it really does nothing except make the datatable expand and fit the container I have it in.

Problem solved, but I’m not really sure why this is necessary:


Function Main()
End Function 

Can anyone elaborate? Obivously the Function Main() runs before anything else - does it run when my project starts (This database is on the fourth form and is not the startup form)

Function Main() is run when all loading is done. If you have a project with lots of libraries (which is certainly the case with DataTables), it’s good to wait until everything is loaded.

1 Like

I have the same problem with the dataTable not updating. It only updates if it is included in the Main() function.

How do i update the table records during normal app use, say if i click a particular button?


This topic is marked as answered. If you have a new question, you should open another issue.