PDA

View Full Version : add parameters to paging attribute



ahsec
27 Feb 2013, 3:48 AM
Hello

I'm trying to add my own dynamic patameters to each paging event. However, it doesn't add them to the request.

I've tried adding the parameter to the extraParams attribute but it doesn't work.

Here's the store


Ext.define('MyApp.store.par_AttsHeaders', { extend: 'Ext.data.Store',


constructor: function(cfg) {
var me = this;
cfg = cfg || {};
me.callParent([Ext.apply({
storeId: 'par_AttsHeaders',
proxy: {
type: 'ajax',
extraParams: '{ \n app_id : get_app_id(Ext.getCmp(\'win_Att1\').getSelectionModel().getSelection()[0])\n}',
url: '/cgi-bin/hybrid/getGlobalHeaders.cgi',
reader: {
type: 'json',
root: 'rows'
}
},
fields: [
{
name: 'header'
},
{
name: 'value'
}
],
listeners: {
load: {
fn: me.onJsonstoreLoad,
scope: me
}
}
}, cfg)]);
},


onJsonstoreLoad: function(store, records, successful, options) {
fold_irrelevant_tables();
}


});

and the grid:


{ xtype: 'gridpanel',
height: 200,
id: 'win_attHeaders',
padding: 5,
autoScroll: false,
collapsed: false,
collapsible: false,
title: 'Headers',
forceFit: true,
store: 'par_AttsHeaders',
columns: [
{
xtype: 'gridcolumn',
width: 319,
dataIndex: 'header',
text: ''
}
],
viewConfig: {
autoScroll: false
},
listeners: {
itemdblclick: {
fn: me.onWin_attHeadersItemDblClick,
scope: me
},
collapse: {
fn: me.onWin_attHeadersCollapse,
scope: me
},
expand: {
fn: me.onWin_attHeadersExpand,
scope: me
}
},
tools: [
{
xtype: 'tool',
id: 'win_attHeaders_tool',
type: 'minimize',
listeners: {
click: {
fn: me.onToolClick2,
scope: me
}
}
}
],
dockedItems: [
{
xtype: 'pagingtoolbar',
dock: 'top',
width: 360,
displayInfo: true,
store: 'par_AttsHeaders'
}
]
}



Thanks :-)

EPV
27 Feb 2013, 5:25 AM
What do you see in the network tab in the network tools?

Your "extraParams" looks strange.
1. extraParams is an object, not a string. http://docs.sencha.com/ext-js/4-1/#!/api/Ext.data.proxy.Ajax-cfg-extraParams
2. Why "\n"?



extraParams: '{ \n app_id : get_app_id(Ext.getCmp(\'win_Att1\').getSelectionModel().getSelection()[0])\n}',


Good luck!