Error in Code in Help Docs

Hello,

I don't think your help docs are open source where I could contribute to them, but there is an error in the code here:


This row does not run in the preview nor in actual code:

 var rowObj = grid.getRowObjectFromUID(closest(args.target, '.e-row').getAttribute('data-uid'));

This resolves the issue using jQuery as for some reason, I couldn't get a querySelector to work with args.target :

var rowObj = grid.getRowObjectFromUID($(args.target).closest('.e-row').attr('data-uid'));

Just wanted to give back after all the awesome support we have received from you all!

1 Reply

TS Thiyagu Subramani Syncfusion Team April 7, 2020 09:20 AM UTC

Hi Mark, 

Thanks for contacting Syncfusion support. 

Query : Error in Code in Help Docs 
 
Sorry for the inconvenience caused. 
 
Based on your reported documentation link we have used closest method to get the row details from the target element. But in this we missed to define origin of closest(base) method. 

So please refer to the modified code and sample. 
 
 var onClick = function(args){ 
    var rowObj = grid.getRowObjectFromUID(new ej.base.closest(args.target, '.e-row').getAttribute('data-uid')); // base method 
    var data = rowObj.data; 
    alert(JSON.stringify(data)); 


{ headerText: 'Commands', width: 120,  commands: [{ buttonOption: { content: 'Details', cssClass: 'e-flat', click: onClick } }]}, 

 
 
(Or) 

By default we have an option as “commandClick event” used to get row details while clicking command column buttons.  Please refer to the below code and sample link. 

var grid = new ej.grids.Grid({ 
. . . . . . 
    columns: [ 
. . . .  
        { headerText: 'Commands', width: 120,  commands: [{ buttonOption: { content: 'Details', cssClass: 'e-flat' } }]}, 
        ], 
        commandClick : function (args){ 
           alert(JSON.stringify(args.rowData)); 
        }, 
    height: 315 
}); 
grid.appendTo('#Grid'); 
 
 


Note : We created an enhancement documentation task for this scenario and intended to refresh our upcoming release. 

Please get back to us, if you need any further assistance. 

Regards, 
Thiyagu S. 


Loader.
Up arrow icon