Click event listener

I did successfully add a row double click event listener to my grid by:

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

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

EDIT

Okay found it:

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

but seems like the result of record.get('name') is not a text! its an object but I cannot handle it as if it a text. any body has any idea ?

EDIT

For example, if I pass the name to search function: Search(record.get('name')); this won't work. but if I pass it this way: Search('Mike'); it works !


Ensure that

  • Your property name is really lowercase 'name' and not 'Name'
  • Print the value of the field into the console with console.log(record.get('name')) or use the direct access by typing console.log(record.data.name) or console.log(record.data['name']) . Basically all should return the same.
  • To cast a value to string apply '' on the fly like var myVar = 2; myVar = myVar + ''; // now print 20 as string var myVar = 2; myVar = myVar + ''; // now print 20 as string

  • 尝试一下,

    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
    }
    
    链接地址: http://www.djcxy.com/p/11582.html

    上一篇: lambda对象的C ++地址作为函数的参数

    下一篇: 点击事件监听器