1. #11
    Sencha User
    Join Date
    Jun 2009
    Posts
    49
    Vote Rating
    0
    thiner is on a distinguished road

      0  

    Default


    Hi joeri,

    You're right, it is not suitable for your extension, but I was trying to improve it, and I found maybe it's impossible, coz the selection function of your plugin base on the 'id' property, and the data from server in that example don't contain it.
    I changed the my data source to which include an 'id' property, and it works smoothly now.
    Any way, thank you for your replying.

  2. #12
    Sencha User
    Join Date
    Aug 2008
    Posts
    110
    Vote Rating
    0
    Rothariger is on a distinguished road

      0  

    Default


    hello,

    im using your extension, and i dont know if im using wrong or what, but i have 2 of these in different grids, but in the same page, each grid is in a tabpanel...

    the thing is, that the selected and selections arrays, they join together in the last defined item.

    its just me?


    ps: im trying to load some selected items at the load of the data, this way after load the store of the grid, im reading an extra store with all previous selected/saved items...
    im doing grid.plugins[x].selected[id] = record and grid.plugins[x].selections.push(record)...
    could be this my problem???

  3. #13
    Ext JS Premium Member
    Join Date
    Aug 2007
    Location
    Antwerp, Belgium
    Posts
    564
    Vote Rating
    61
    joeri is a jewel in the rough joeri is a jewel in the rough joeri is a jewel in the rough joeri is a jewel in the rough

      0  

    Default


    You're going to have to post an example of that one. I can't quite figure out what you're driving at.

  4. #14
    Sencha User
    Join Date
    Aug 2008
    Posts
    110
    Vote Rating
    0
    Rothariger is on a distinguished road

      0  

    Default


    here is the code...

    declaration of the plugin and checkbox selection columns.

    Code:
      psQuestion = new Ext.ux.grid.RowSelectionPaging({id: 'psQuestion'});
        psSOVI = new Ext.ux.grid.RowSelectionPaging({id: 'psSOVI'});
        var colPOCActive = new Ext.grid.CheckboxSelectionModel({id:'colPOCActive',header:' ', dataIndex:'active', width: 30, listeners: { beforerowselect: fnBeforeSelect, beforerowdeselect: fnBeforeSelect, rowdeselect: fnRowDeselect } });
        var colQActive = new Ext.grid.CheckboxSelectionModel({id:'colQActive',header:' ', dataIndex:'active', width: 30, listeners: { beforerowselect: fnBeforeSelect, beforerowdeselect: fnBeforeSelect } });
    and here are the grid declarations
    Code:
    {
                                                            xtype: 'editorgrid'
                                                           , id: 'egrdData'
                                                           , title: titlePOC
                                                           , height: 240
                                                           , width: 470
                                                           , loadMask: true
                                                           , view: new Ext.grid.GridView({})
                                                           , listeners: {afteredit: fnAfterEdit, beforeedit: fnBeforeEdit, rowmousedown: function(grid) { hinderSelection = true; }}
                                                           , enableColumnHide: false
                                                           , cm: new Ext.grid.ColumnModel([
                                                                                            colPOCActive,
                                                                                            {header: description,tooltip: description,  dataIndex: 'description', width: 120, sortable: true, hideable: false},
                                                                                            {header: quantity,tooltip: quantity, dataIndex: 'quantity', width: 60, sortable: false, resizable: false, hideable: false,
                                                                                                editor: new Ext.form.NumberField({id: 'numQty', maxValue: 9999, maxLength: 4, allowDecimals: false, allowNegative: false}) },
                                                                                            {header: score,tooltip: score, dataIndex: 'score', width: 60, sortable: false, resizable: false, hideable: false,
                                                                                                editor: new Ext.form.NumberField({id: 'numScore', maxValue: 99999, maxLength: 5, allowDecimals: false, allowNegative: false}) }
                                                                                         ])
                                                            , store: strGRD
                                                            , sm: colPOCActive
                                                            , plugins: [psSOVI] 
                                                            , bbar: ptGRD
                                                            , tbar: [
                                                                        description + ': ', ' ',
                                                                        new Ext.app.SearchField({
                                                                            store: strGRD
                                                                            , id: 'sfContracts' 
                                                                            , width:150
                                                                            , pagingToolbar: ptGRD
                                                                        }), ' ', ' ', '-', ' '+ score + ':  ', {xtype: 'tbtext', id: 'tbtTotalContract', text: '0'}] 
                                                           },{
                                                            xtype: 'editorgrid'
                                                           , id: 'egrdQuestions'
                                                           , title: questions
                                                           , height: 240
                                                           , width: 470
                                                           , loadMask: true
                                                           , view: new Ext.grid.GridView({})
                                                           , listeners: {afteredit: fnAfterEditQuestion, beforeedit: fnBeforeEdit, rowmousedown: function() { hinderSelection = true; }}
                                                           , enableColumnHide: false
                                                           , cm: new Ext.grid.ColumnModel([
                                                                                            colQActive, 
                                                                                            {header: description,tooltip: description,  dataIndex: 'description', width: 120, sortable: true, hideable: false},
                                                                                            {header: score, tooltip: score, dataIndex: 'score', width: 60, sortable: false, resizable: false, hideable: false, 
                                                                                                editor: new Ext.form.NumberField({id: 'numScoreQuestion', maxValue: 99999, maxLength: 5, allowDecimals: false, allowNegative: false}) }
                                                                                         ])
                                                            , store: strGRDQuestions
                                                            , sm: colQActive
                                                            , plugins: [psQuestion] 
                                                            , bbar: ptGRDQuestions
                                                            , tbar: [
                                                                        description + ': ', ' ',
                                                                        new Ext.app.SearchField({
                                                                            store: store
                                                                            , id: 'sfQuestions' 
                                                                            , width:150
                                                                            , pagingToolbar: ptGRDQuestions
                                                                        }), ' ', ' ', '-', ' ' + score + ':  ', {xtype: 'tbtext', id: 'tbtTotalQuestions', text: '0'}] 
                                                           }


    and here is what i do when the store loads...

    Code:
    // i do this for each store with the respecting plugin...
        strLocal.each(function (record){
            psSOVI.selected[record.id] = true;
            psSOVI.selections.push(record); 
        });  
    
     strLocalQuestion.each(function (record){
            psQuestion.selected[record.id] = true;
            psQuestion.selections.push(record); 
        });    
    
    // i have tryed with this also....
        strLocal.each(function (record){
            psSOVI.onRowSelect(null, null, record);
        });   
    
    
     strLocalQuestion.each(function (record){
            psQuestion.onRowSelect(null, null, record);
        });

    i dont know..

    thanks for any help... i will post if i can make it work...

  5. #15
    Ext User
    Join Date
    Apr 2009
    Location
    Haifa, Israel
    Posts
    4
    Vote Rating
    0
    MasterAM is on a distinguished road

      0  

    Thumbs up Nicely done!

    Nicely done!


    @joeri
    I totally agree that the perfect approach to this thing is a plugin.
    Just started using it with ExtJS 3.0, on several grids with row selection model in single selection mode.

    Works flawlessly so far.

    Just one thing worth mentioning is the use of Ext.preg and ptype for lazy loading of plugins.
    I added this at the end of the plugin code:

    PHP Code:
    Ext.preg('rowselectionpaging'Ext.ux.grid.RowSelectionPaging); 
    And then, on the grid definition:
    PHP Code:
    ...
    plugins:[{ptype:'rowselectionpaging'}]
    ... 
    Excellent work, again!

    @Rothariger,
    It's hard to tell w/o seeing a working example.
    I suggest stepping through the code when you do the manual selection addition and when a new page renders in the grid (e.g, breaking at the plugin's onViewRefresh method.
    That is, of course, if the matter is not resolved already...

  6. #16
    Sencha User
    Join Date
    Aug 2009
    Posts
    16
    Vote Rating
    0
    jocampo is on a distinguished road

      0  

    Default


    @joeri

    Excellent plugin.!! may could you help me.. I am using your plugin but when somebody put directly in the paging bar the number of the page they want and come bact to some page where the had a selection the selection is gone.. The fast solution could be just lock the paging bar to use only the button.. but may you can help finding a better solution.. Something else, I need when somebody use the "select / deselect all" really select all the data in the grid and not only the data in the page.. could you tell me what could be the better way to do it, modify the code of the plugin or just make an extension of the code?

    thanks in advance.!

    PD: i kind of new using ExtJS and i am using ExtJS 3.0

  7. #17
    Ext JS Premium Member
    Join Date
    Aug 2007
    Location
    Antwerp, Belgium
    Posts
    564
    Vote Rating
    61
    joeri is a jewel in the rough joeri is a jewel in the rough joeri is a jewel in the rough joeri is a jewel in the rough

      0  

    Default


    The problem with a real "select all" is that not all the rows are loaded into the store, so you don't even know what "all" is. You would first have to force the store to load all its rows, then add them all to a selection, and then refresh the grid. I tried a few different approaches to doing that, but none of them were clean enough that I felt they belonged in this plugin.

    About your other issue, I can't reproduce that in the demo I included in the first posts. Could you describe step by step how you're doing that?

  8. #18
    Sencha User
    Join Date
    Aug 2009
    Posts
    16
    Vote Rating
    0
    jocampo is on a distinguished road

      0  

    Default


    @joeri

    Thanks for your answare, my first problem about not persisting selected item if i just jump between the pages using the text box in the paging bar was a cache problem.. after i clean it works really good.!!

    Now my problem is with the "select/deselect all" issue yet.. I am working on it.. any clue?!

  9. #19
    Ext User
    Join Date
    Sep 2009
    Posts
    14
    Vote Rating
    0
    mrbeig9 is on a distinguished road

      0  

    Default select/deselect all anyone?

    select/deselect all anyone?


    awesome plugin!! loved it.. but did anyone tried the selectall for the grid yet... i m trying on that.. if anyone comeup with something.. please share..

  10. #20
    Sencha User
    Join Date
    Dec 2008
    Location
    NYC
    Posts
    182
    Vote Rating
    0
    whodat is on a distinguished road

      0  

    Default


    Quote Originally Posted by mrbeig9 View Post
    awesome plugin!! loved it.. but did anyone tried the selectall for the grid yet... i m trying on that.. if anyone comeup with something.. please share..
    I've implemented the check/select all for the grid

    Method added to the class

    Code:
    checkAll: function(){
             var i=0;
            this.clearSelections();
            for(i=0, it = this.grid.store.allData.items, l = it.length; i < l; i++) {
                var recordArray=it[i].data;
                var rec=this.grid.store.getById(it[i].data['your record's ID']);
                this.selections.push(rec);
                this.selected[rec.id] = true;
            }
            this.onViewRefresh();
        }