EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: korenanzo on June 16, 2016, 07:14:34 AM



Title: know my name
Post by: korenanzo on June 16, 2016, 07:14:34 AM
Hi

let's say I have a combogrid, with id: 'myCombo123'


$('#xx').combogrid( {
...
id: myCombo123,
...
} )

in the combogrid I add a
Code:
onClickRow: function (index, _row) {
// do something */
var me = this; // me == 'the data grid owned by the combogrid
},
onShowPanel : function (a) {
   bla();
 var me = this; // me == 'the textfield owned by the combogrid


},


which is the most simple, secure and correct way to know, when onClickRow is executed, to know 'my name' that is 'myCombo123' ?


I've seen that I can get $(this).data('datagrid').options.id but not sure if it's the best  , even because depending to the 'on*' event, I should choose the correct object:
if I'm in onSHowPanel I'd use $(this).data('combogrid').options.id ... it's a mess!!!

Is there something unique and standard??
 
Thanks,
RIc



Title: Re: know my name
Post by: CLKG on June 16, 2016, 06:30:06 PM
Combogrid's events extend from combo and datagrid.

onShowPanel is combo's while onClickRow belongs to datagrid

use $.data(this, 'combo').options.id for onShowPanel and $.data(this, 'datagrid').options.id for onClickRow.

Hi

let's say I have a combogrid, with id: 'myCombo123'


$('#xx').combogrid( {
...
id: myCombo123,
...
} )

in the combogrid I add a
Code:
onClickRow: function (index, _row) {
// do something */
var me = this; // me == 'the data grid owned by the combogrid
},
onShowPanel : function (a) {
   bla();
 var me = this; // me == 'the textfield owned by the combogrid


},


which is the most simple, secure and correct way to know, when onClickRow is executed, to know 'my name' that is 'myCombo123' ?


I've seen that I can get $(this).data('datagrid').options.id but not sure if it's the best  , even because depending to the 'on*' event, I should choose the correct object:
if I'm in onSHowPanel I'd use $(this).data('combogrid').options.id ... it's a mess!!!

Is there something unique and standard??
 
Thanks,
RIc




Title: Re: know my name
Post by: korenanzo on June 16, 2016, 11:33:15 PM
Combogrid's events extend from combo and datagrid.

onShowPanel is combo's while onClickRow belongs to datagrid

use $.data(this, 'combo').options.id for onShowPanel and $.data(this, 'datagrid').options.id for onClickRow.


the same thing I said :)

I am asking for a better, linear solution ...