Data Grid detailTemplate - Shift collapse arrow from most left to most right of row

Hi all

May i ask if there is any way to shift the collapse arrow in data grid detailTemplate from most left to most right?


arrow.png


Thanks
Yu Feng


4 Replies

JC Joseph Christ Nithin Issack Syncfusion Team September 1, 2021 06:41 PM UTC

Hi Yu Feng, 

Thanks for contacting Syncfusion support. 

  We have validated your requirement, if you want to change entire Grid from left to right we suggest you to use the `enableRtl` property of the EJ2 Grid.  

  Please find the code example for your reference .  

<GridComponent dataSource={employeeData} 
               detailTemplate={this.template.bind(this)} 
               width="auto" 
               enableRtl={true}> 
 
    <ColumnsDirective> 
 
        <ColumnDirective field="FirstName" 
                         headerText="First Name" 
                         width="110" /> 
 
        <ColumnDirective field="LastName" 
                         headerText="Last Name" 
                         width="110" /> 



  


If this does not meet your requirement, could you please confirm whether you want to shift only collapse icon from left to right?  

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

Regards, 
Joseph I. 



OY ONG YU FENG September 2, 2021 02:03 AM UTC

Hi Joseph


I would just want to shift the collapse icon from left to right without affecting the rest of the text layout. By doing enableRtl would affect the text alignment 



JC Joseph Christ Nithin Issack Syncfusion Team September 2, 2021 04:35 PM UTC

Hi Yu Feng, 

  Thanks for your update. 

  Based on your requirement you want to move the expand and collapse icon to the right side without affecting the text layout in the grid. We have logged your requirement as a custom sample and we will provide further details about this  on 7th September, 2021. We appreciate your patience until then. 

Regards, 
Joseph I. 



JC Joseph Christ Nithin Issack Syncfusion Team September 7, 2021 01:40 PM UTC

Hi Yu Feng, 

Thanks for your patience. 

  Based on your requirement you want to move the expand and collapse icon of the group header to the right side of the grid. We have prepared a custom sample to achieve your requirement. 

  Your requirement can be achieved by cloning the expand collapse icon’s cell element and then inserting after the group caption’s cell element with some css style to position the icon to the right side of the grid in the `dataBound` event of the EJ2 Grid. 

Please refer the code example below. 


dataBound() { 
    var expandIcon = $('.e-recordplusexpand') 
      .last() 
      .clone(); 
    $('.e-recordplusexpand').remove(); 
    $('.e-groupcaption').after(expandIcon); 
    $('.e-recordplusexpand').each(function() { 
      $(this) 
        .children() 
        .css('float''right'); 
      $(this) 
        .children() 
        .css('padding-right''15px'); 
    }); 



 


Please find the attached sample and revert for more queries. 

Regards, 
Joseph I 


Loader.
Up arrow icon