EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: Ellipsis on October 18, 2012, 12:57:30 AM



Title: Get parent from grid which throws an event
Post by: Ellipsis on October 18, 2012, 12:57:30 AM
Is it possible to retrieve the original ID of the table or input on which the grid is created ?

For example:

HTML
Code:
<input id='studentSearch' class='personSearch' searchType='student'/>
<input id='teacherSearch' class='personSearch' searchType='teacher'/>

......

JAVASCRIPT
Code:
jQuery('.personSearch').combogrid('grid').datagrid({onSelect: function(rowIndex, rowData){
   var calledById = ....?
   var searchType = ....?



Title: Re: Get parent from grid which throws an event
Post by: stworthy on October 18, 2012, 08:44:14 PM
Try the following code:
Code:
$('.personSearch').each(function(){
var target = this;
$(target).combogrid('grid').datagrid({
onSelect: function(index,row){
var searchType = $(target).attr('searchType');
//...
}
});
});


Title: Re: Get parent from grid which throws an event
Post by: Ellipsis on October 19, 2012, 12:29:35 AM
I used this method to create al 'empty' combogrids, I never thought about using this same method for the events :)