We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

ACTION OF CUSTOMIZATION TOOLBAR

Hello
I need  to example of a action of to button of customization toolbar in the moment that select to row.



1 Reply

VN Vignesh Natarajan Syncfusion Team March 22, 2019 06:47 AM UTC

Hi Guadalupe, 
 
Thank for contacting Syncfusion support. 
 
Query: ACTION OF CUSTOMIZATION TOOLBAR 
 
We have achieved your requirement using custom toolbar feature of ejGrid. And using toolbarClick event we have changed the alignment of selected tr. 
 
Please refer the below code example, 
 
  <ej:Grid ID="OrdersGrid" runat="server" AllowPaging="True"> 
        <ClientSideEvents ToolbarClick="onToolBarClick" /> 
………………….. 
        <ToolbarSettings ShowToolbar="True"> 
            <CustomToolbarItem> 
                <ej:CustomToolbarItem Text="left" /> 
                <ej:CustomToolbarItem Text="center" /> 
                <ej:CustomToolbarItem Text="right" /> 
            </CustomToolbarItem> 
        </ToolbarSettings> 
        <Columns> 
…………………………… 
    </ej:Grid> 
 
 
    <script type="text/javascript"> 
        function onToolBarClick(sender) { 
            var gridObj = $("#<%= OrdersGrid.ClientID %>").data("ejGrid"); 
            var rowIndex = gridObj.model.selectedRowIndex; 
            var tr = gridObj.getRows()[rowIndex]; 
            if (sender.itemName == "left") 
                $(tr).find('td').css('cssText', 'text-align: left !important'); 
            else if (sender.itemName == "center") 
                $(tr).find('td').css('cssText', 'text-align: center !important'); 
            else 
                $(tr).find('td').css('cssText', 'text-align: right !important'); 
 
        } 
    </script> 
 
    <style type="text/css" class="cssStyles"> 
        .left { 
            background-image: url("../Content/left.png"); 
            background-size: 20px 20px; 
        } 
 
        .center { 
            background-image: url("../Content/center.png"); 
            background-size: 20px 20px; 
        } 
 
        .right { 
            background-image: url("../Content/right.png"); 
            background-size: 20px 20px; 
        } 
    </style> 
 
</asp:Content> 
 
 
Refer the below link for sample, 
 
 
Also refer the below link for help documentation and demo, 
 
 
 
 
Please get back to us if you have further queries. 
 
Regards, 
Vignesh Natarajan. 


Loader.
Live Chat Icon For mobile
Up arrow icon