PDA

View Full Version : [SOLVED]Combine 2 columns to 1



vzhen
17 Sep 2009, 3:31 AM
In the learning-extjs 2.0 chapter 5, combine two columns to one.

function title_tagline(val,x,store){
return '<b>' + val + '</b><br>' + store.data.tagline;

I not really understand the params passed because just started learning js. What are they (val,x,store) in function title_tagline.
Let me guess, the val is the thing (title) and store is the thing (tagline) we need to pass but how about x. Anyone can explains to me ?

Thank you

VinylFox
17 Sep 2009, 5:19 AM
In that case, 'x' is just a var given to one of the arguments that is passed into the renderer function that we are not going to use. A 'throw away' variable, so to speak. That renderer only makes use of the 1st and 3rd arguments that are passed in, so 'x' is essentially a spacer to help us get at the 3rd argument. Hope that makes sense.

The docs give you a list of what arguments are passed into a renderer function.

http://www.extjs.com/deploy/dev/docs/?class=Ext.grid.ColumnModel&member=setRenderer

vzhen
17 Sep 2009, 4:57 PM
I got you.

Thank again VinylFox