Intersoft Support Center

Manipulate Data in Rows and Cells

In WebCombo, you can manipulate data such as adding, deleting and updating from client-side.

This topic will show you how to add item, delete row and perform batch update in unbound WebCombo.

To add item in unbound WebCombo from client side

  1. Drag HTML Button to the page.
  2. Add the following function in client-side to add the item:

    JavaScript Copy ImageCopy Code
    function AddItem()
    {
       var wc = ISGetObject("WebCombo1");
       var rows = wc.GetRows(); // get the WebCombo4's rows for addition
       var newRow = wc.NewRow("NEWCUST2"); // instantiate new row with NEWCUST as the KeyValue, containing cells with empty value
       var cells = newRow.GetCells(); // get the cells of the new row for value assignment
                                    
       // addition
       cells.GetNamedItem("ContactName").Text = "New Customer"; // write codes in the same way as in server-side object model, with similar object hierarchy.
       cells.GetNamedItem("Address").Text = "New Address"; // assign value to Address Cell
       cells.GetNamedItem("CustomerID").Text = "NEWCUST";
       rows.Add(newRow); //add the newRow to the rows collection
                                    
       // update all changes now
       wc.UpdateUI();
    }

  3. Next, add onclick ="AddItem()" on the HTML Button's tag like following:

    <input id="Button1" type="button" value="Add Item" onclick="Add Item()" />

  4. Run the project.

To delete a row in unbound WebCombo

  1. Go to HTML view and add the following code:

    JavaScript Copy ImageCopy Code
    function DeleteRow()
    {
       var WebCombo1 = ISGetObject("WebCombo1");
       var rows = WebCombo1.GetRows();
       rows.Remove(rows[0], true); //remove row 0 from Rows collection, 2nd parameter must always be set to true
       WebCombo1.UpdateUI();
       alert("Row 0 removed!");
    }                            
    

  2. Invoke DeleteRow() function by adding the following code:

    <input id="Button1" type="button" value="Delete Row" onclick="DeleteRow()" />

To perform batch update in unbound WebCombo

  1. Set WebCombo to unbound mode.
  2. Go to HTML view and add the following code:

    JavaScript Copy ImageCopy Code
    function BatchUpdate() 
    {
       var WebCombo1 = ISGetObject("WebCombo1");
       var firstRow= WebCombo1.GetRows()[0]; // get the WebCombo1's rows
       var firstCell = firstRow.GetCells()[0];
       firstCell.Text = "Changed Text"; // modify the text
       firstRow.SetChanged();
       WebCombo1.UpdateUI();
       alert("Batch Update done!");
    }

  3. Invoke BatchUpdate() function by adding the following code:

    <input id="Button1" type="button" value="Update" onclick="BatchUpdate()" />
Previous Next