Extjs Grid - Click event listener

I have successfully added a row double click event listener to my grid:

listeners : { itemdblclick: function(dv, record, item, index, e) { alert('working'); } }, 

Now I need to get the exact value in the third column in the selected row, how can I do this?

EDIT

Ok, I found this:

 listeners: { itemclick: function(dv, record, item, index, e) { alert(record.get('name')); } } 

but it looks like the result of record.get('name') not text! it is an object, but I cannot deal with it as with text. does any body have any ideas?

EDIT

For example, if I Search(record.get('name')); name in the search function: Search(record.get('name')); it will not work. but if I go through it like this: Search('Mike'); it works !

+9
source share
2 answers

Make sure that

  • Your property name has a lowercase "name", not a "name"
  • Print the field value in the console using console.log(record.get('name')) or use direct access by typing console.log(record.data.name) or console.log(record.data['name']) . Basically, everyone should return the same.
  • To apply a value to a string, apply '' on the fly as var myVar = 2; myVar = myVar + ''; // now print 20 as string var myVar = 2; myVar = myVar + ''; // now print 20 as string
+4
source

Try

 listeners: { itemclick: function(dv, record, item, index, e) { var selectedRec = dv.getSelectionModel().getSelected(); alert(selectedRec.get('name')); //Will display text of name column of selected record } 
0
source

All Articles