[CLOSED] How to access the original data/rows bound to the GridPanel which are invisible after applying filter.

Page 1 of 2 12 LastLast
  1. #1

    [CLOSED] How to access the original data/rows bound to the GridPanel which are invisible after applying filter.

    Hi Team,

    I have a GridPanel in which i have a CheckColumn.
    When there is change in the check box selection of any rows, I have to run a logic which should read the the whole store and based on the some columns data it will select checkboxes of those rows also. To do this i have a checkchange listner on this column which go and check other column for some data and select the checkboxes of those rows.

    ==== C# code =========
    colSW.Listeners.CheckChange.Handler = "onColumnCheckChange(column, rowIndex, record, #{" + grid.ID + "});";
    ===================

    ========== Java Script =============
      var onColumnCheckChange = function(column, rowIndex, record, grid) {
                    var gridStore = record.store;
    
                    gridStore.each(function(curRecord, index) {
                        if (index !== rowIndex) {
                            //check/uncheck(based on current action) the checkboxes of the all the other rows which has submitflag = "Y"
                           if(curRecord.data.submitflag =="Y")
                                    curRecord.data.SUBMIT_TO_WORKFLOW_FLAG = record.data.SUBMIT_TO_WORKFLOW_FLAG;
                        }
    
                    });
                               
                    gridStore.commitChanges();
    
             }
    ===============================

    It works fine when I check any column which will read the whole store and check for other rows which satisfy the required condition and select checkboxes of those rows also.

    But when there is a filter applied and after that if i select some checkbox in the rows left, i am not able to read those other rows which arent visibile because of the filter applied, so when i remove the filter those related column which satisfy the required condition will remain un-checked.

    I need your help to know how to access the whole store(GridPanel rows data, including rows which are not visible because of the applied filter) when there is a filter applied.

    Please refer some screenshots attached. Click image for larger version. 

Name:	Step1_Step2_Screenshot.JPG 
Views:	48 
Size:	84.9 KB 
ID:	5745Click image for larger version. 

Name:	Step3_Step4_Screenshot.JPG 
Views:	45 
Size:	95.6 KB 
ID:	5746

    And also what is the best method to save the store of a perticular row (after check/uncheck of a column) without losing the focus on the row where user has checked the checkbox.
    Last edited by Daniil; Mar 05, 2013 at 6:38 AM. Reason: [CLOSED]
  2. #2
    Hi,

    Try this
    var onColumnCheckChange = function(column, rowIndex, record, grid) {
        var gridStore = record.store,
            temp;
    
        if(gridStore.snapshot){
            temp = gridStore.data;
            gridStore.data = gridStore.snapshot;
        }
     
        gridStore.each(function(curRecord, index) {                 
            // make required actions with records
        });
    
        if(temp){
            gridStore.data = temp;
        }
                              
        gridStore.commitChanges(); 
    };
  3. #3
    And also what is the best method to save the store of a perticular row (after check/uncheck of a column) without losing the focus on the row where user has checked the checkbox.
    What do you mean "save"? Do you mean apply changes to grid? If yes then grid rerender row (element in the grid) to display changes therefore focus can be lost

    You can reselect row to return focus (may be need to clear selection before)
    
    grid.view.getSelectionModel().select(indexOfRow);
    grid.view.el.focus();
  4. #4
    Quote Originally Posted by Vladimir View Post
    Hi,

    Try this
    var onColumnCheckChange = function(column, rowIndex, record, grid) {
        var gridStore = record.store,
            temp;
    
        if(gridStore.snapshot){
            temp = gridStore.data;
            gridStore.data = gridStore.snapshot;
        }
     
        gridStore.each(function(curRecord, index) {                 
            // make required actions with records
        });
    
        if(temp){
            gridStore.data = temp;
        }
                              
        gridStore.commitChanges(); 
    };


    Vladimir,

    It works as expected, thanks for the quick solution, I appreciate.
  5. #5
    Quote Originally Posted by Vladimir View Post
    What do you mean "save"? Do you mean apply changes to grid? If yes then grid rerender row (element in the grid) to display changes therefore focus can be lost

    You can reselect row to return focus (may be need to clear selection before)
    
    grid.view.getSelectionModel().select(indexOfRow);
    grid.view.el.focus();

    Vladimir,

    I want the row on which initial checkbox event was triggered, to be focused(not selected) after changing/committing the store changes.
  6. #6
    Quote Originally Posted by Tarun Chand View Post
    to be focused(not selected)
    Please clarify what exactly do you mean under "focused"?
  7. #7
    Quote Originally Posted by Daniil View Post
    Please clarify what exactly do you mean under "focused"?
    Daniil,

    Thanks for responding, please check this attached screenshot where I have explained the scenario and the expected result with grid images.
    Click image for larger version. 

Name:	ScrollBarPostion.jpg 
Views:	43 
Size:	101.9 KB 
ID:	5754


    Thanks for your time.
    Last edited by Tarun_Chand; Mar 04, 2013 at 2:18 PM.
  8. #8
    Thank you for the explanation.

    I think the focusRow method can help.
    http://docs.sencha.com/ext-js/4-1/#!...ethod-focusRow

    Example
    App.GridPanel1.getView().focusRow(index);
  9. #9
    Try to set PreserveScrollOnRefresh="true" for GridView
    See http://docs.sencha.com/ext-js/4-1/#!...crollOnRefresh
  10. #10
    Quote Originally Posted by Daniil View Post
    Thank you for the explanation.

    I think the focusRow method can help.
    http://docs.sencha.com/ext-js/4-1/#!...ethod-focusRow

    Example
    App.GridPanel1.getView().focusRow(index);
    Daniil,

    This is what I really wanted. Thank you Daniil.
Page 1 of 2 12 LastLast

Similar Threads

  1. [CLOSED] DataView template JS error when bound with data
    By cleve in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: Jun 07, 2012, 1:51 PM
  2. [CLOSED] Access to record when field is bound?
    By PatrikG in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Jul 04, 2011, 5:11 PM
  3. Store original object from data source
    By nextSTEP in forum 1.x Help
    Replies: 8
    Last Post: Feb 16, 2011, 1:12 PM
  4. Replies: 2
    Last Post: Dec 02, 2009, 12:08 PM
  5. Replies: 3
    Last Post: Mar 12, 2009, 3:09 PM

Tags for this Thread

Posting Permissions