Generate the cascade script¶
This operation assembles the JavaScript function body that the grid invokes before a cell enters edit mode, so the child column's value list is rebuilt from only the options matching the parent column's current value.
| Field | Value |
|---|---|
| Operation ID | OP-02 |
| Trigger | Called from Cascade grid drop-down value lists (step 7); also callable directly by consumers as a public method |
| Inputs | l1, l2, Column1.Key, Column2.Key |
| Outputs | A String containing a complete <script> block defining BeforeEdit<Column2Key>(gridName, cellId) |
| Primary components | clsDropDownController.GenerateJavaScript |
| Entry point | SAIF.Presentation.Web.Controls.Infragistics111/clsDropDownController.vb |
Steps¶
- Open a
<script type="text/javascript">block and emit the function headerfunction BeforeEdit<Column2.Key>(gridName, cellId){(BR-CTL-003). - Emit lookups of the current column and row via the Infragistics client API (
igtbl_getColumnById,igtbl_getRowById). - Emit an early-return guard: if the edited column's
Keyis notColumn2.Key, the function returns without altering the value list (BR-CTL-001). - If the edited column is not the child column: the guard short-circuits and the value list is left unchanged.
- Emit retrieval of the parent cell value via
row.getCellFromKey("<Column1.Key>").getValue()and declare an emptyvListFilterarray. - Emit a
switch(catCell)statement with onecase "<item1.id>":per entry inl1(BR-CTL-001). - Within each case, emit one
vListFilter[n] = new Array("<item2.id>","<item2.desc>")line for eachl2entry whosekey.ToUpperequals that parentid.ToUpper(BR-CTL-002). - If a parent value has no matching children: the emitted filter array is empty, which clears the child list at runtime.
- On failure: an
l2entry with aNothingkeyraises aNullReferenceExceptionon.ToUpper— no guard exists.* - Emit
col.ValueList=vListFilter;, close the function and the<script>block, and return the string. Values are concatenated without JavaScript/HTML encoding (BR-CTL-006).
Process flow¶
The following diagram visualizes this operation's control flow.
flowchart TD
Start([GenerateJavaScript called]) --> S1["Emit function header<br>BeforeEdit + Column2.Key"]
S1 --> S2["Emit column/row lookups"]
S2 --> D{"Edited column ==<br>Column2.Key?"}
D -->|No| EndNoop(["Return without change"])
D -->|Yes| S3["Emit switch(catCell)<br>one case per l1 item"]
S3 --> S4["Emit filtered vListFilter<br>from matching l2 items"]
S4 --> S5["Emit col.ValueList = vListFilter"]
S5 --> EndOk(["Return script string"])
Failure and edge-case behavior¶
- An
l2entry whosekeyisNothingraises an unhandledNullReferenceExceptionwhen.ToUpperis called during script generation — there is no null guard.* - A parent value with no matching child entries produces an empty filter array, which clears the child column's value list at runtime rather than leaving it unchanged.
Related documentation¶
Note: Statements marked with
*were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts.
Sources¶
SAIF.Presentation.Web.Controls.Infragistics111/clsDropDownController.vb