Visual Builder

Get Involved. Join the Conversation.

Topic

    Sunil Polineni
    How to change the values of other tables based on selected...Answered
    Topic posted August 13, 2019 by Sunil PolineniRed Ribbon: 250+ Points, tagged JET, UI, Web 
    17 Views, 7 Comments
    Title:
    How to change the values of other tables based on selected row on table1 on page
    Summary:
    How to change the values of other tables based on selected row on table1 on page
    Content:

    I am helping a customer who wants to select a row on table1 and change the
    values of other tables.

    This is working fine but we can not achieve this when page initially loads. I
    had added both events to VBEnter

    I can see the row is selected but the second table is not changed any
    pointers appreciated.

    I am attaching the sample.
    https://xxxxxxxxxxxxxxxxxxx/ic/builder/design/yyyyyyy/1.0/preview/webApps/webapp/

    Best Comment

    David Konecny

    I had a look at your application and this is timing issue - sometimes tables are rendered correctly even on first opening for me. Most of the time they are not though.

    The cause is that at the moment (there is a product enhancement tracked to make this configurable) SDP always starts loading data upon page opening. And so before "first-selected-event" is received all page's SDPs (and there is dozen of them) start fetching all rows because no filter criteria are set on them yet. And at random point in time the filter criteria are set and all SDP should refresh themselves and show right records only. So it looks like a timing/synchronisation bug that SDPs do not update themselves. But even if they did the application UI would flicker as all records would show up first only to disappear again with their correct subset.

    The right solution is to hide all dependent tables and show them only after "first-selected-event" was received and processed. Which should be very easy to do: in all TableFirstSelectedRowChangeChainXXX just add additional assignment of DataAreReadyForTableXXXX=true (which has default value of false) and conditionally show table *** using <oj-bind-if DataAreReadyForTableXXXX>

    -David

    Comment

     

    • Shay Shmeltzer

      The tricky part is that the user hasn't selected a row in the first table, so how are we suppose to know which data to show in the other tables?

      If the assumption is that we want to show data for the first row in the table, an approach you can try:

      In the vbEnter event - execute the REST call that gets the records for the first table - based on the results from this pick the id value from the first row, and then assign it to the filter criteria on the other SDPs on the page.

      An alternative, in case we can't make this assumption, is to use oj-bind-if to hide the rest of the tables on the page, until the user actually selects a value in the first table.

       

    • Sunil Polineni
    • Sunil Polineni
    • Sunil Polineni

      Hi Shay,
      I had uploaded two screen shots.
      firstRowSelected_onpageLoad --> you can see that row is selected when page is loaded initially.
      Changed_value_oj-select-one.png--> after page is loaded if I select the value from the list it is working fine.
      Regards,
      Sunil

    • Sunil Polineni

      Attached the sample.

    • David Konecny

      I had a look at your application and this is timing issue - sometimes tables are rendered correctly even on first opening for me. Most of the time they are not though.

      The cause is that at the moment (there is a product enhancement tracked to make this configurable) SDP always starts loading data upon page opening. And so before "first-selected-event" is received all page's SDPs (and there is dozen of them) start fetching all rows because no filter criteria are set on them yet. And at random point in time the filter criteria are set and all SDP should refresh themselves and show right records only. So it looks like a timing/synchronisation bug that SDPs do not update themselves. But even if they did the application UI would flicker as all records would show up first only to disappear again with their correct subset.

      The right solution is to hide all dependent tables and show them only after "first-selected-event" was received and processed. Which should be very easy to do: in all TableFirstSelectedRowChangeChainXXX just add additional assignment of DataAreReadyForTableXXXX=true (which has default value of false) and conditionally show table *** using <oj-bind-if DataAreReadyForTableXXXX>

      -David

    • Sunil Polineni

      Thank you shay and David able to implement the solution and help the customer.