New row added to model through adoptRows not showing fields in the table

  • 1
  • Problem
  • Updated 2 years ago
  • Solved
I am adding a row in a model with the help of adaptRows function. The table which is listing all the rows in the model is showing a new blank row, but no field values. Through alerts in Javascript I can see the field values are getting populated.

Any pointers would be of great help. 
Thanks!!

-Sayali
Photo of Sayali Dehedkar

Sayali Dehedkar

  • 180 Points 100 badge 2x thumb

Posted 3 years ago

  • 1
Photo of Jarrod Hinson

Jarrod Hinson

  • 2,310 Points 2k badge 2x thumb
I am having this same issue. I have a JSON array with the keys named the same as the field ids on the model and when I do JS model.adoptRows it works and the Model gets all the rows and the values are in the rows successfully.

BUT, the Table that displays non-UI only fields does not render the values, UI Only fields render fine and the values are there. 

Ex. I have a JSON with 2 keys like below. Both values get placed into the model and are retrievable but when displayed in table component Account__c is blank but uiOnlyField is not.
{"Account__c": "001xxxxxxxxxxx","uiOnlyField": "Value Here"}
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
I'm not completely sure here,  but I'm guessing you need to refresh the table component after adopting rows. 
Photo of Jarrod Hinson

Jarrod Hinson

  • 2,310 Points 2k badge 2x thumb
I was trying to figure out how to do that but couldn't seem to find the right syntax. Do you have an example of that in javascript?
Photo of Velvel Marasow

Velvel Marasow

  • 172 Points 100 badge 2x thumb
To refresh the table that it should ask it's model for data:
skuid.component.getById('<tableUniqueID>').render();
It will re-render the table but won't request any new data.
Photo of Adam Edmonds

Adam Edmonds

  • 454 Points 250 badge 2x thumb
I'm having a similar issue, but wanted to check here before starting another post.  Using adoptRows brings data into the model.  However, I'm creating the skuidTable component dynamically using the code below.  As you can see in the attached screenshot, the table recognizes the rows, but doesn't show any data.  In the component code, I've added the field I expect to be displayed.


        var xmlDefinition = $xml(
            '<skootable showconditions="false" showsavecancel="false" searchmethod="client" searchbox="true" showexportbuttons="false" pagesize="10" createrecords="false" model="PriceList" mode="read"/>'        ).append(
            $xml('<fields/>').append(
                $xml('<field id="Product" allowordering="true"/>')
            ),
            $xml('<views><view type="standard"/></views>')
        );
        element.empty();
        var comp = skuid.component.factory({
            element: element,
            xmlDefinition: xmlDefinition
        });

        comp.rerender(); //comp.render();
(Edited)