Tagged: 

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #112247
    Scott Arnold
    Participant

    I’m using a smart table by creating it with this syntax:

    
    window.Smart(divId, class {
      get properties() {
        return {
          dataSource: new window.Smart.DataAdapter({
            dataSource: [],   // initially just empty table
            id: id,
            dataFields: [ ... ]
          }),
          ...
        }
      }
    });
    

    After that I use methods like addRow and others to work with the table. Most of the time, this works, but on occasion I get errors like follows:

    
    Uncaught (in promise) TypeError: Cannot read properties of null (reading 'boundSource')
    

    This happens on first call to addRow about 5% of the time.

    Is the Smart call async maybe? Like can I call window.Smart().then(…)? It seems like I need to somehow wait for the table to finish initializing.

    #112262
    admin
    Keymaster

    Hi Scott,

    We tried to reproduce this without much success. Could you share a full sample which shows the issue you experienced?

    Best regards,
    Peter

    Smart UI Team
    https://www.htmlelements.com/

    #112285
    Scott Arnold
    Participant

    Thanks for checking. I’m setting up the table within another web component. I realized that I may just need to do a requestUpdate() after the window.Smart() (or possibly an await requestUpdate()). I’ll try that and see if it fixes the problem.

    Will the window.Smart call return an instance of the table? If so, I could also possibly just save that instance instead of looking up the table by ID with a query selector.

    • This reply was modified 3 weeks, 6 days ago by Scott Arnold.
    #112287
    Markov
    Keymaster

    Hi Scott,

    It does not return an instance of the table so will need to use ID or CSS class querySelector.

    Best regards,
    Markov

    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.