PDA

View Full Version : Grid Panel Listener - Retrieving Data from an Object



oneofakind007
22 Sep 2012, 10:25 PM
Hey Community,

Guys, I'm quite new to extJS and I would like your help.
I have this Grid.Panel with listeners, I don't know if i got it right. Anyway, I got it to print out its properties but I cant get the data. Here is what the console printed out.

Object { internalId=, raw={...}, data={...}, more...}

after clicking it:

38873

The "data" encircled in red. How do get those information?

metalinspired
23 Sep 2012, 12:58 AM
Can you post some code?
Image you attached shows a model instance whose data you can get with get() (http://docs.sencha.com/ext-js/4-1/#!/api/Ext.data.Model-method-get) function.

mitchellsimoens
24 Sep 2012, 11:25 AM
Yeah, so to get the name property in the data object, you can do:


record.get('name')

and it will return 'Barney Stinson' from what the image shows

mohammadamir
11 Apr 2013, 5:51 AM
I nm not understand what happen is going on.

dockedItems: [{
xtype: 'toolbar',
dock: 'top',
items:[{
text: '<img src="../static/images/refresh.gif" title="xyz">',
enableToggle: true,
iconCls: 'refresh', //nice refresh icon
listeners: {
toggle: function (button, pressed) {
var grid = button.up('grid');
if (!Ext.isDefined(grid.refreshTask)) { //check if the task is already created
grid.refreshTask = runner.newTask({ //create task
run: function () { getdata(); },
interval: 30000
});
}
if (pressed) { //toggle between start and stop
grid.refreshTask.start();
} else {
grid.refreshTask.stop();
}
}
}
}]


I want to add tooltip on image its done but iconCls: 'refresh', take some spece after image image show when I remove " iconCls: 'refresh', " its not show tooltip text.

metalinspired
11 Apr 2013, 10:19 AM
don't use text property to define icon.
you should define icon as background-image in CSS class that you add in iconCls.
to add tooltip simply add tooltip (http://docs.sencha.com/ext-js/4-2/#!/api/Ext.button.Button-cfg-tooltip) property to the button you're creating and call Ext.tip.QuickTipManager.init(); when initializing your application to enable tooltips

mohammadamir
11 Apr 2013, 9:21 PM
Thanks metalinsepride
I was missing to add Ext.tip.QuickTipManager.init();

mohammadamir
11 Apr 2013, 10:13 PM
Now I want to use tooltip dynamic when button is pressed tooltip = start when button unpressed tooltip = stop.
What I will have to add ?