TableSheet Change DataSource Dynamically - multiColumn Display

Posted by: michael.thrift2 on 6 September 2022, 11:42 pm EST

  • Posted 6 September 2022, 11:42 pm EST - Updated 3 October 2022, 12:01 am EST

    In the GIF below you will see a collection that is displayed using the TableSheet component. We do not allow a user to add a new record using the feature available in the TableSheet. Instead a user must click the “Add Associate” button which will add a new record to the collection at the server. Once that is done, we execute the following code to refresh the view so that the added record is reflected in the TablSheet display:

    
    export async function SetActiveView(workbookName: string, tableName: string, viewName: string, reload: boolean) {
    
        var spread = GC.Spread.Sheets.findControl(workbookName);
        
        if (spread) {
            var sheet: GC.Spread.Sheets.TableSheet.TableSheet = spread.getSheetTab(tableName);
            
            var view = dataViews[viewName];
    
            if (view) {
                await view.fetch(reload);
                sheet.setDataView(view);
            }
     
        }
    }
    
    

    This seems to work, and from the GIF below you will see that a new record appears at the top with the EmplID of “TEMP23”.

    However there is also a TableRelationship being used to associate the employee’s “JobCode” with the “Job Title”. The jobcode of the newly added associate is “100100”.

    But you will see from the GIF that the jobcode display for that associate is not correct. It is displaying the jobcode for the record below it. And each record is affected. So each record is now showing the jobcode-title that is actually for the row below it.

    Once i update a value for any record, the TableRelationship seems to correct itself and all records re-render the JobCode display and it is corrected.

    If you watch the GIF carefully you will see how the job code value does not line up with what is being displayed. You will also see how everything corrects itself once I update a single value.

    I’ve tried:

    • "

    • “Refreshing Table instead of View”

    • “Refreshing spreadsheet control entirely”

    • “Removing and readding the TableRelationship”

    "

    Nothing seems to force the “correction” other than updating a record cell value. Is there some method i can invoke manually to achieve this as a workaround?

    Hopefully this is enough to identify the problem. I could setup a demo but that would take a decent amount of time to reproduce.

  • Posted 7 September 2022, 10:17 pm EST

    Hi,

    We understand this but we are not able to replicate it on our end. Could you please share a working sample that replicates the issue so that we could investigate it further and help you accordingly?

    Regards,

    Avinash

  • Posted 14 September 2022, 12:38 am EST

    Avinash,

    Please see working sample below. Please follow these steps to reproduce:

    https://jscodemine.grapecity.com/sample/yZS_NBef-EyibxWQ_cCr8Q/

    1. When the project loads, click the “Get Data” button. You will see the TableSheet populates correctly with the Relational View intact connecting Orders with Customer data.

    2. Click the “Refresh Data” button. This will invoke the view fetch(true) method and force the TableSheet to retrieve the data again. But this time the data will have 1 extra record that was added to the collection at the beginning of the collection. The Order ID of this new record is “0”.

    3. At first it may look like everything has worked. But the “customer” column display (formatter) is incorrect. Everything has been pushed up. So the first record “Order ID: 0” has the customer display from the record below it. And this continues for the entire table until you get to the last record. The last record now has a “#NA” display.

    If you double click into the customer cell you will see the “CustomerId” value. That value is correct, but it seems to be joining to the wrong record on the Customer table because it is displaying the wrong customer detail info.

    1. Modify the “Freight” amount on the first record (Order ID: 0) and you will see the “customer” column correct itself with the display refreshing to the correct value.
  • Posted 14 September 2022, 6:27 pm EST

    Hi,

    We are able to observe the issue hence we have escalated this issue to the concerned team for further investigation. We will update you once we get any information from the team. The internal ID for this issue will SJS-14724.

    Regards,

    Avinash

  • Posted 15 September 2022, 12:40 am EST

    Good Day,

    Is there any temporary workaround that I can use to force the column to refresh.

    After changing a value, the relational view column refreshes and displays correctly. Can I cause the same behavior through code without changing a value? I’ve tried spread.refresh(), i’ve tried ws.invalidateLayout() / ws.repaint(). I’ve tried sheet.refreshBindColumns()

    This is a blocking issue for our product and I cannot push our implementation to production without a solution for this.

  • Posted 18 September 2022, 6:28 pm EST

    Hi,

    We have shared the information with the team and asked them to increase the priority. We will update you as soon as we get any information from the team.

    Regards,

    Avinash

  • Posted 13 October 2022, 5:10 pm EST

    Hi,

    the issue has been fixed in our latest build that 15.2.3. Please update to the latest build and let me know if you still face any issues.

    Regards,

    Avinash

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels