How to refresh grid when factory source is updated?

Posted by: kp on 10 August 2020, 8:44 am EST

    • Post Options:
    • Link

    Posted 10 August 2020, 8:44 am EST

    I currently have a custom editing process for our background source, however that source isn’t bound the usual way to the grid as a source but rather an object linked in the factory for creating the cells as we want them to look.

    The refresh() method likely uses the normal source, but is there a way to force an update on a column/row or the entire grid that uses the factory to rebuild it?

    I have tried updating the factory with the changed source and then readding the factory before refresh() but that didn’t do anything. The source object does get the changes as leaving and rebuilding the entire view does update it, though it remakes all objects on the view, not just the grid.

  • Posted 12 August 2020, 11:04 am EST

    Hi KP

    Can you please share a small sample, how you are using ItemSource in the background which is linked with the factory? that will help us to assist you better.

    Thanks

  • Posted 17 August 2020, 2:58 am EST

    I am making a custom factory and adding an object with it’s own data and lots of settings, I don’t use the ItemSource object at all. since all binding is done through my factory(I don’t know what kind of data I have until runtime ranging from images, to numbers, text and unicode characters, all of which are supposed to act differently on interactions and such). That is probably the reason why the refresh method doesn’t work for me.

    The data is updated when I scroll the cell out of the grid and back in, so I was hoping there was a way to make it rebuild the specified cell by forcing the same methods as used there.

  • Posted 17 August 2020, 2:58 am EST

    I am making a custom factory and adding an object with it’s own data and lots of settings, I don’t use the ItemSource object at all. since all binding is done through my factory(I don’t know what kind of data I have until runtime ranging from images, to numbers, text and unicode characters, all of which are supposed to act differently on interactions and such). That is probably the reason why the refresh method doesn’t work for me.

    The data is updated when I scroll the cell out of the grid and back in, so I was hoping there was a way to make it rebuild the specified cell by forcing the same methods as used there.

  • Posted 18 August 2020, 10:02 am EST

    Hi KP

    The way you are setting data in the FlexGrid in not common, we need a small sample which adds data through factory that you are using, that will help us to assist you better.

    Thanks

  • Posted 20 August 2020, 7:09 am EST

    gridfac = new CustomGridCellfactory(m_cPivot);

    CellFactory = gridfac;

    Pivot is an object with a huge amount of different settings and an array only accessible through a method calling the column and row. The returned object from the array contains a few more settings and another object that maybe contains a value field.

    And then I use the pivot in the bindCellContent method.

    My BindCellContent class is big and checks multiple of the settings in different branching paths based on what data is parsed, ie if the data parsed is a string then do 3-4 checks because it might an image path or simply a text.

    I was hoping I could force it to update on the given range position by calling the bindcellcontent method, since it seems to properly update the grid when I scroll down and up again(moving the cell out).

    Edit: I don’t use itemsource at all, all data is set in the factory, since the cells need to be rebuilt for our style a lot with many different choices even for specific cells and I won’t know what data is in the object until I go through the many checks for the specific cell, setting data twice by adding an itemsource seems redundant in this case.

  • Posted 21 August 2020, 4:56 am EST

    Hi KP

    If we set the dynamic data in the BindCellContent method of the CellFactory, then on calling the Refresh method of the FlexGrid, the data will update dynamically in the FlexGrid.

    For reference please see the attached video

    Steps to follow

    • Execute the attached sample.

    • Click on GettingStarted Row.

    • Click on Refresh button.

    • Observe the data in the FlexGrid.

    Please let me know if you need any other help.

    Thanks

    GridRefresh.zip

    FlexGrid101.zip

  • Posted 25 August 2020, 8:19 am EST

    Thank you I found out that the updated source wasn’t applied to the factory, and I have made a workaround.

Need extra support?

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

Learn More

Forum Channels