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.