PDA

View Full Version : How to know about a object's methods/properties ?



gameboy87
24 Jul 2012, 5:40 AM
I need to set the tip height in the chart dynamically. So, is there any function do this ?

I used console.log(<object-name>) But I can find only the properties for that and not the methods. Please Help on this !

I was able to identify my tip height by chart_id.series.items[0].tips.height

But how to set the tip height ?

WillBill
24 Jul 2012, 6:08 AM
setHeight():
http://docs.sencha.com/ext-js/4-0/#!/api/Ext.tip.Tip (http://docs.sencha.com/ext-js/4-0/#!/api/Ext.tip.Tip)


if you do a console.log(tipObject).. you should be able to find the methods in __proto__

friend
24 Jul 2012, 9:07 AM
Another fairly easy way to do this is via the renderer in the tips config:



tips: {
height: 30,
width: 70,
trackMouse: true,
renderer: function(storeItem, item) {
var fieldValue = storeItem.get('someField');

// if text length greater than 50 characters, increase tip height.
if (fieldValue.length > 50) {
this.height = 100;
}

this.setTitle(storeItem.get('someField');
}
}

gameboy87
31 Jul 2012, 5:25 AM
Thanks guys...I will try it out.. :)