Skip to content

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

  1. Open a <script type="text/javascript"> block and emit the function header function BeforeEdit<Column2.Key>(gridName, cellId){ (BR-CTL-003).
  2. Emit lookups of the current column and row via the Infragistics client API (igtbl_getColumnById, igtbl_getRowById).
  3. Emit an early-return guard: if the edited column's Key is not Column2.Key, the function returns without altering the value list (BR-CTL-001).
  4. If the edited column is not the child column: the guard short-circuits and the value list is left unchanged.
  5. Emit retrieval of the parent cell value via row.getCellFromKey("<Column1.Key>").getValue() and declare an empty vListFilter array.
  6. Emit a switch(catCell) statement with one case "<item1.id>": per entry in l1 (BR-CTL-001).
  7. Within each case, emit one vListFilter[n] = new Array("<item2.id>","<item2.desc>") line for each l2 entry whose key.ToUpper equals that parent id.ToUpper (BR-CTL-002).
  8. If a parent value has no matching children: the emitted filter array is empty, which clears the child list at runtime.
  9. On failure: an l2 entry with a Nothing key raises a NullReferenceException on .ToUpper — no guard exists.*
  10. 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 l2 entry whose key is Nothing raises an unhandled NullReferenceException when .ToUpper is 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.

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