How to refresh grid with new data Items and with existing column

Posted by: arulventhan.palanimuthu on 7 June 2018, 5:47 pm EST

    • Post Options:
    • Link

    Posted 7 June 2018, 5:47 pm EST

    Hi sir/mam,

    I need to update an spread view grid. I have an columns list, now i updating an data items with new values, here i need to refresh the grid without page load.

    My Codes as follows,

    On Init

    
    var data = [{ city: null,   createdDate: "0001-01-01T00:00:00",    createdUser: null},
            { city: null,   createdDate: "0001-01-01T00:00:00",    createdUser: null},
    { city: null,   createdDate: "0001-01-01T00:00:00",    createdUser: null},
    { city: null,   createdDate: "0001-01-01T00:00:00",    createdUser: null},
     ];
    
    

    On update my data list changed as follows

    
    var data = [{ city: 'NY',   createdDate: "2018-06-08 00:00",    createdUser: 'Arul'},
            { city: null,   createdDate: "0001-01-01T00:00:00",    createdUser: null},
    { city: 'LA',   createdDate: "2018-06-08 00:00",    createdUser: 'Venthan'},
    { city: null,   createdDate: "0001-01-01T00:00:00",    createdUser: null},
     ];
    
    

    now i need to update the grid without any dataview reload.

    My code as follows on init

    
    dataView = new GC.Spread.Views.DataView( document.getElementById( 'grid1' ), data, columns,
                            new GC.Spread.Views.Plugins.GridLayout( { 
                                allowSorting: false,
                                showColHeader: true,
                                showRowHeader: false,
                                allowResizing: true,
                                selectionMode: 'single',
                                showToolPanel: false,
                                allowColumnReorder: true,
                                allowCellMerging: true,
                                //grouping: grouping
                            } ) );
    
    

    on update i tried

    
    
      dataView.refresh();
     dataView.invalidate();
    
    
    

    also tried by

    
    
      dataView.data.refresh();
     dataView.invalidate();
    
    
    

    Its not working for me, while i re-init the dataview its loads and took much to load grid.

    Thanks,

    Arulventhan NP

  • Posted 10 June 2018, 9:22 pm EST

    Hi Arul,

    After editing multiple rows you can call saveBatchEdit() method. For example:

    dataView.saveBatchEdit();

    After this you can call the refresh/invalidate method.

    Thanks,

    Deepak Sharma

  • Posted 11 June 2018, 6:49 pm EST

    Hi Deepak Sharma,

    I am not work on batch edit. Here i am getting data array from server side.

    here on init my data array like follows,

    var data = [{ city: null,   createdDate: "0001-01-01T00:00:00",    createdUser: null},
          { city: null,   createdDate: "0001-01-01T00:00:00",    createdUser: null},
    { city: null,   createdDate: "0001-01-01T00:00:00",    createdUser: null},
    { city: null,   createdDate: "0001-01-01T00:00:00",    createdUser: null},
    ];
    

    After i getting data from server side the data array will updated as

    var data = [{ city: 'NY',   createdDate: "2018-06-08 00:00",    createdUser: 'Arul'},
            { city: null,   createdDate: "0001-01-01T00:00:00",    createdUser: null},
    { city: 'LA',   createdDate: "2018-06-08 00:00",    createdUser: 'Venthan'},
    { city: null,   createdDate: "0001-01-01T00:00:00",    createdUser: null},
     ];
    

    In this case what i need to do for refresh the grid to update new data array without re-init the grid.

    And is there any way to use dataView.data.updateItem for updating more than one columns. without an index.

    Thanks ,

    Arulventhan NP

  • Posted 13 June 2018, 11:29 pm EST

    Hi Arul,

    Calling the Refresh() and Invalidate() method in this case should work just fine.

    Could you please provide me a sample application to debug this issue further?

    Thanks,

    Deepak Sharma

Need extra support?

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

Learn More

Forum Channels