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.
Unfortunately, activation email could not send to your email. Please try again.

How to show the toolbar items based on the grid row selected index?

This Knowledge base explains the way of how to show or hide the toolbar items in grid based on selected row index.

Solution

 This can be achieved using rowSelected event of ejGrid. The rowSelected event will get trigger when selecting the rows of the grid and based on the rowIndex (argument in rowSelected event) value the toolbar items in grid can be show or hide.

The following code example demonstrates how to show or hide the toolbar items based on selected row index:

 

  1. Render the grid control

JS

 

RAZOR

 

C#

 

 

ASPX

 

 

ASP.NET CORE

                                                                                                                                                 

Angular

 

  1. Using create event we have hide the toolbar items initially.

 

TS file

 

  1. Using rowSelected event in grid the required toolbar items can be show or hide based on rowIndex value.

 

JS

 

C:\Users\Manisankar.durai\Desktop\Edit.png

Figure 1: shows the edit icon in toolbar when the selected row index is less than 5

 

C:\Users\Manisankar.durai\Desktop\add.png

 

Figure 2: shows the add icon in toolbar when the selected row index is greater than 5 and less than 7.

 

C:\Users\Manisankar.durai\Desktop\add and delete.png

Figure 3: shows add and delete icon in toolbar items when selected row index is greater than 7.

Article ID: Published Date: Last Revised Date: Platform: Control:
8309 01/16/2018 01/16/2018 JavaScript ejGrid
Tags:
Did you find this information helpful?
Add Comment
You must log in to leave a comment

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.