Hybrid View
-
25 Sep 2012 7:24 PM #1
Extjs 4.x Return value from Ext.window.window combobox to update selected records
Extjs 4.x Return value from Ext.window.window combobox to update selected records
Firstly I am new to EXTJS and am stuck with this issue and no solution for weeks. Your help is much appreciated.
I have a grid with CheckboxModel. So a user can select x rows and click on button called "Update Status". This button should open a pop-up window with list of Statuses (Active, In-Active, Closed etc.) in a combobox and button for save and cancel. When user presses Save, update all selected rows/records with the selection value in the combobox, can close the window.
.....///
selModel: Ext.create('Ext.selection.CheckboxModel', {
listeners: {
selectionchange: function (sm, selections) {
Ext.ComponentQuery.query('#UpdateStatus')[0].setDisabled(selections.length == 0);
}
}
....../////
SampleExtJS4Image.jpg
-
25 Sep 2012 7:43 PM #2
Here is some code I used to do the same thing. It change the status of selected record in grid.
This uses a remove table and sends the id's of the selected records to the server where the updating is handled
Scott.Code:// perform actual change to selected records on_change_status: function(item,event,status) { var selRows = this.grid.getSelectionModel().getSelection(); if (selRows.length > 0) { var requests = []; for (var i = 0, rec; rec = selRows[i]; i++){ requests.push({ id: selRows[i].data.id_request }); } // ajax call to delete all id instead of multiple calls to store.remove Ext.Ajax.request({ method: 'POST', url: 'index.php/requests/change_status/', params : { ids: Ext.encode(requests), // list of requests status: status }, success: function() { // observable catches errors }, failure: function() { alert('AJAX FAILURE: Unable to change selected requests'); } }); // update view storeRequests.load(); } else { alert('NOTICE: You must select a request to perform this action'); } },
-
30 Sep 2012 4:34 PM #3
Hey Scott,
Thank for your response. It has been a great help.
DaveLast edited by daviboysmith; 30 Sep 2012 at 4:37 PM. Reason: revise


Reply With Quote