-
16 Nov 2012 12:30 AM #1
Answered: How to use extraParams?
Answered: How to use extraParams?
Hi,
First I am sending a request (param) to the server and using the same PHP for another grid, but that grid doesn't give me data with passed param
, but when I send param in the url I can get it done. When I searched for it, there is an object extraParams, I am using like,
This doesn't seem to work, it isn't sending the extra parameter. What am I doing wrong?Code:{ xtype: 'gridpanel', url: 'php/update.php', extraParams: { 'columnname': selectedField } }
Thanks.
-
Best Answer Posted by willigogs
Where are you wanting to build the array of selected field values? You shouldn't do this on every checkbox select, but rather just prior to performing your AJAX call (I'm assuming on a button push somewhere?).
You can then pass "arr" as your extra param during the AJAX call.Code:var selections = Ext.getCmp('your_grid_id').getSelectionModel().getSelection(); var arr = []; Ext.each(selections, function(rec, index) { arr.push(rec.get('Field')); });
-
16 Nov 2012 3:50 AM #2
I have to send parameter somewhere else, I did that and it worked. Now I have a CheckboxModel, I need to get value(s) of selected fields.
I have code like,
checkedField has the currently selected value, how can I get array of selected values (comma separated, may be join() will do)?Code:onCheckboxselectionmodelSelect: function(rowmodel, record, index, options) { checkedField = record.get('Field'); }
Can someone help me? Thanks in advance.
-
16 Nov 2012 7:02 AM #3
-
16 Nov 2012 7:20 AM #4
Hi Albareto,
I have seen that as a solution in many threads, I am having my grid in Ext.apply(), how do i address 'grid' in grid.getSelectionModel().getSelection(), because it says 'undefined'
. Please give me a simple code to get values and tell me how that is saved, like an array or we can have it comma separated (better for my requirement).
And also, I am getting JSON response from PHP, how do I save one of the values to a variable? Please help.
Thanks!
-
16 Nov 2012 7:27 AM #5
I cannot help you if you don't show your code. You can get components by using the Ext.ComponentQuery object or, in case your grid has an id, using Ext.getCmp('yourId');
For saving values that you receive after an update you can capture the load event from your store and put the logic you need there. But again without a sample code of how you are doing things it is difficult to answer your questions.
-
16 Nov 2012 7:40 AM #6
Hi,
The grid looks like,
So the checked values in this grid will be needed for another operation, for example, if the grid has,Code:Ext.applyIf(me, { items: [ { xtype: 'gridpanel', height: 223, width: 133, store: 'Store', columns: [ { xtype: 'gridcolumn', width: 105, dataIndex: 'Field', text: 'Fields' } ], viewConfig: { autoRender: true }, selModel: Ext.create('Ext.selection.CheckboxModel', { listeners: { select: { fn: me.onCheckboxselectionmodelSelect, scope: me } } }) } ] }); me.callParent(arguments); }, onCheckboxselectionmodelSelect: function(rowmodel, record, index, options) { checkedField = record.get('Field'); }
with checkboxes for it on left and if I am checking test1 and test2, I should have it liketest1
test2
test3
or something like this comma separated.Code:variable = {test1, test2}
For JSON, if I am getting response like,
I want to save table to a variable, how that can be done?Code:{"value":[{"Field":"test1","table":"tablename"},{"Field":"test2","table":"tablename"},{"Field":"test3","table":"tablename"}]
Thanks in advance!
-
16 Nov 2012 8:23 AM #7
Where are you wanting to build the array of selected field values? You shouldn't do this on every checkbox select, but rather just prior to performing your AJAX call (I'm assuming on a button push somewhere?).
You can then pass "arr" as your extra param during the AJAX call.Code:var selections = Ext.getCmp('your_grid_id').getSelectionModel().getSelection(); var arr = []; Ext.each(selections, function(rec, index) { arr.push(rec.get('Field')); });
-
17 Nov 2012 12:55 AM #8
Hi willigogs,
Thanks for the reply. I did the one you told on a button and it works good, I check on checkboxes and while clicking button it sends like,
Can I have these values like,HTML Code:http://localhost/testing/php/update.php?fieldName=test1&fieldName=test2
I need to use this for another operation.Code:fieldName=test1, test2
Please help in saving the JSON response to a variable I asked in my previous post.
Thanks!


Reply With Quote