The QDataGrid Row Actions

Adding actions to data grid row is very similar to adding actions to any other QControl. In a QControl, we use the AddAction() method for adding actions. For data grid rows we'll use QDataGrid's AddRowAction() method exactly the same way. In a QControl, we use the ActionParameter property to pass parameters to the action. For the data grid, we'll use the QDataGrid's RowActionParameterHtml property to pass parameters to the row actions. In fact, the RowActionParameterHtml uses the same technique and the same variables as seen in the QDataGrid variables example.

In the example below, we'll make the data grid rows respond to mouse movements and to clicks anywhere in the row. To achieve it, we'll need to add 3 actions to our data grid: one for mouse over, one for mouse out, and one for click. We'll use the QCssClassAction action to add a CSS class when the mouse is over a row or goes out of the row. We'll use a standard QAjaxAction for the click handler to call our QForm's method which will simply tell us which row we just clicked on.
Row # First Name Last Name Full Name
1 kavita 2 arulyfred arulyfred, kavita 2
2 Kendall2 Publics Publics, Kendall2
3 Ben 5665564 5665564, Ben
4 Mike Ho Ho, Mike
5 Alex Smith Smith, Alex
6 Wendy Smith Smith, Wendy
7 Karen Wolfe Wolfe, Karen
8 Samantha Jones Jones, Samantha
9 Linda Brady Brady, Linda
10 Jennifer Smithfgfg Smithfgfg, Jennifer
11 Brett Carlisle j Carlisle j, Brett
12 Jacob Pratt Pratt, Jacob
13 sdf sdf sdf, sdf
14 sdhgfhsdg jai jai, sdhgfhsdg
15 billy wilder wilder, billy
16 Nice Job Job, Nice
17 good job job, good
18 moi tpo77 tpo77, moi
19 test test test, test