FlexGrid bounded updateDB

Posted by: fsegui on 24 July 2022, 7:18 am EST

    • Post Options:
    • Link

    Posted 24 July 2022, 7:18 am EST

    Hi,

    I’m using FlexGrid bounded to a database.

    I’m loading info through a BackGroundWorker as I’ve a lot of data. During the process, I’m displaying a message telling the user to wait.

    When done, the user can update one or several info directly in the databas (using forms, procedures…)

    How can I reflect the changes in the flexgrid without loading all datas again?

    Thanks

    I’ve provided a sample to show how my app is working.FlexSelection.zip

  • Posted 24 July 2022, 9:37 pm EST

    Hi Florent,

    We do not see a way to get the updated data without refetching the data. We have asked the development team for their insights. We will let you know when we get an update.

    [C1WIN-27804]

    Regards

    Avnish

  • Posted 21 August 2022, 5:44 pm EST

    Hi Avnish,

    Any update from dev team?

    Thanks

    Regards

    Florent

  • Posted 28 August 2022, 11:03 pm EST

    Hi,

    As per the development team, you can load only modified rows to a data table and then merge that data with the data table that is used with FlexGrid.

    There is no way to do this directly since you need to have some information about which rows were updated.

    So you need to add a timestamp/rowversion column to the table that gets updated whenever a row is updated and then you can get the IDs of the rows that were updated and perform further operations.

    Regards

    Avnish

  • Posted 29 August 2022, 2:38 am EST

    Hi Avnish,

    Thanks for your feedback, I’ve got all info on rows updated (I already have a timestamp column).

    But I’m not sure of how to refresh only some rows with a binded FlexGrid. Is there a sample in the ComponentOne Demo folder?

    Regards

    Florent

  • Posted 29 August 2022, 4:08 pm EST

    Hi Florent,

    You can first get the updated rows from the database and then you can use the ItemsArray property of the DataRow and assign the new data to the old row and then call AcceptChanges method of the DataRow.

    For Each newRow As DataRow In newData.Rows
         Dim row As DataRow = dt.Select($"CustomerID = '{newRow(0)}'")(0)
         row.ItemArray = newRow.ItemArray
         row.AcceptChanges()
    Next
    

    Please refer to the modified sample attached. We used an SQL server at our end.

    Regards

    Avnish

    FlexSelection_rowversion.zip

  • Posted 30 August 2022, 11:40 pm EST

    Hi Avnish,

    Thanks a lot. That works perfectly!

    Regards

    Florent

Need extra support?

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

Learn More

Forum Channels