Results 1 to 4 of 4

Thread: Back end update for selected rows

  1. #1

    Default Back end update for selected rows

    ExtJS newbie here, started my first application yesterday. Pretty basic so far, populates a grid with the contents of a database table. I added a CheckboxSelectionModel column to select rows and added a button to the toolbar. Now I need to attach a handler to the button to spin through the checked rows and update a field in the associated database table records. I'm having trouble finding how to do this, can anyone point me to an example?

    Thanks!

  2. #2
    Sencha User
    Join Date
    Dec 2009
    Posts
    425

    Default

    Something like this...
    Here the handler makes an Ajax call to the server side with the selected records' ids
    Code:
    var selections = OptionsListingGrid.selModel.getSelections();
    var ids = '';
    
    
    for (var i = 0; i < selections.length; i++) {
        
        ids += selections[i].id + ',';
    }
    
    
    
    Ext.Ajax.request({
        waitMsg: 'Deleting...',
        url: 'RTService.asmx/delete',
        params: {
            ids: ids.substring(0, ids.lastIndexOf(','))
        },
        success: function (response) {
    
    
            Ext.MessageBox.alert('Success','Campaign(s) deleted.');
            
        },
        failure: function (response) {
            Ext.MessageBox.alert('Error', 'Could not connect to the database. Please Retry.');
        }
    });

  3. #3

    Default

    Thanks! I'm trying to understand what will be the contents of the elements of the array returned by getSelections(). The documentation doesn't seem to say, the source code says selections.items, and I can't figure out what's in items. Can I expect a particular object type? What does the id attribute contain?

  4. #4
    Sencha User
    Join Date
    Dec 2009
    Posts
    425

    Default

    getSelections() returns an array of Ext.data.Record objects.
    Id needs to be set when you populate a store with records.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •