PDA

View Full Version : Store With Parameters



thilakmsc
29 Aug 2012, 3:55 AM
Dear All.,




Ext.define('ModelCopyListDefinition2', {
extend: 'Ext.data.Model',
fields: [
{name: '_TenantID'},
{name: '_ListDefinitionName'}
]
});

var StoreCopyListDefinition2 =new Ext.create('Ext.data.Store', {

model: 'ModelCopyListDefinition',
pageSize: 3,
proxy:
{
type: 'ajax',
url: 'http://http://118.102.161.169/List/ScriptPage/ScriptPageProxy.aspx/GetDefinitionFields',
params:[{ListDefinitionName:selectedItems}],
method:'GET',

reader:
{
type: 'json',
root: 'd'

}
}
});


StoreCopyListDefinition2.load({});



I'm unable to get the Value from Url., But if use the URL from the browser i will get the result like follows.

URL : http://118.102.161.169/List/ScriptPage/ScriptPageProxy.aspx/GetDefinitionFields?ListDefinitionName=SampleTable1

(Just i was replace selectedItems(From store Url) to SampleTable1)



{'d': [{"_TenantID":"1001","_ListDefinitionName":"SampleTable1","_FieldID":1,"_ImportSize":20,"_FieldName":"Name","_FieldType":"nvarchar","_FieldTypeIndex":2,"_Size":30,"_Validation":"Alphanumeric","_AllowBlank":true,"_Mapping":"1","_AllowExport":true},{"_TenantID":"1001","_ListDefinitionName":"SampleTable1","_FieldID":2,"_ImportSize":20,"_FieldName":"Name2","_FieldType":"nvarchar","_FieldTypeIndex":2,"_Size":30,"_Validation":"Alphanumeric","_AllowBlank":true,"_Mapping":"1","_AllowExport":true}]}

redraid
29 Aug 2012, 4:59 AM
You can use proxy extraParams (http://docs.sencha.com/ext-js/4-1/#!/api/Ext.data.proxy.Ajax-cfg-extraParams) or pass params in store load method:

store.load({
params: {
param1: '1',
param2: '2'
}
});