This knowledge base explains how to set a default value for a field in child grid based on the query string value.
We can achieve this using actionComplete event of ejGrid. By this event we can set the default value to that column for the child Grid.
By default, the query string value will be shown as a default value for the newly added record in the child Grid, but if the child Grid dataSource has the foreignKey field for the query string then we suggest you follow the below code examples.
1. The Hierarchy Grid initialization as follows.
2. In actionComplete event of child Grid we check the condition with the requestType as add and set the default value to the foreign Key field column using currentviewData of child Grid.
Figure 1: At Initial Rendering of Hierarchy Grid.
Figure 2: Default value shown in InspectorID column in child Grid.
|Article ID:||Published Date:||Last Revised Date:||Platform:||Control:|