PDA

View Full Version : regarding passing parameters



nmohan.025
1 Sep 2010, 10:35 PM
hi.........
i'am doing search according to the alphabeticals..i placed all the letters on panel toolbar.now i want to send the button text value to the backend file... how can i send..
any one knows the solution help me

Condor
1 Sep 2010, 10:57 PM
So you want something like:

{
xtype: 'button'
text: 'A',
handler: function(){
store.load({params: {filter: 'A'}});
}
}

nmohan.025
1 Sep 2010, 11:04 PM
i have written a factory function to print alphabets and added togglehandler to it: i want the store to load on click of the particular albhabet, i am not getting the scope of store, how to get it?: i written this function in different file
getLetter = function letters() {
var items = [];

for (var i = 65; i <= 90; i++) {
//
items.push({
text: String.fromCharCode(i),
enableToggle: true,
toggleGroup: 'AZsearch',
toggleHandler: buttonToggleHandler,
scope: this,

}, '', '-', '');

}
for (var i = 49; i <= 57; i++) {
items.push({
text: String.fromCharCode(i),
enableToggle: true,
//store:this.store,
toggleGroup: 'AZsearch',
toggleHandler: buttonToggleHandler,
}, '-', '');
}
return items;
}
buttonToggleHandler = function (button, state) {
if (state == true) {
var abc = button.text;
alert(getStore);
ds.load({
params: {
task: 'alpha_search'
}
});
}
}

I am using it like this: in main front end file
Code:

var alpha_letter=new getLetter();

tbar:{alpha_letter}

Condor
1 Sep 2010, 11:37 PM
1. It's:

var alpha_letter = getLetter();
...
tbar: alpha_letter
2. Why not simply include 'abc' in the params for the ds.load?

nmohan.025
2 Sep 2010, 12:19 AM
I tried that but ds is not loading because that factory function is in different file

Condor
2 Sep 2010, 12:39 AM
So the problem is that you don't have access to the store?

Is this the tbar for the grid itself? In that case you could use:

var grid = button.findParentByType('grid');
var ds = grid.getStore();

nmohan.025
2 Sep 2010, 1:01 AM
i tried this but it is showing grid is null

Condor
2 Sep 2010, 1:11 AM
You are currently setting the scope of the button handler to 'this', but you could also set it to a parameter that is passed to the getLetters method.
I assume you know the store when you call getLetters?

steffenk
2 Sep 2010, 3:38 AM
look at this:
http://www.sencha.com/forum/showthread.php?96146-AZ-Filter-for-Grid