在客户端为非绑定模式下WebCombo添加数据

作者:控件中国网   出处:控件中国网   2016-05-11 14:28:10   阅读:6

WebCombo是Intersoft公司推出的一款功能强大的下拉列表框控件,该控件支持多种数据源绑定,支持客户端数据绑定,支持数据的懒加载,并且可以通过设计时设计和运行时代码操作,并且该控件还可以和WebTreeView以及WebContextMenu进行整合。这篇文章主要介绍在非绑定模式下如何使用代码在客户端为WebCombo添加数据,下面是具体的代码:
webcombo.png
function addItem()
{
   var wc4 = ISGetObject("WebCombo1");
   var rows = wc4.GetRows(); // get the WebCombo4's rows for addition
   var newRow = wc4.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 Customer2"; // write codes in the same way as in server-side object model, with 
 
similar object hierarchy.
   cells.GetNamedItem("Address").Text = "New Address2"; // assign value to Address Cell
   cells.GetNamedItem("CustomerID").Text = "NEWCUST2";
   rows.Add(newRow); //add the newRow to the rows collection
 
   // modification
   cells = rows[1].GetCells();
   cells[0].Text = "Changed Text"; // modify the text
   rows[1].SetChanged();
                                 
   // update all changes now
   wc4.UpdateUI();
}
<input id="Button1" type="button" value="Test" onclick="addItem()" />
Copyright© 2006-2015 ComponentCN.com all rights reserved.重庆磐岩科技有限公司(控件中国网) 版权所有 渝ICP备12000264号 法律顾问:元炳律师事务所
客服软件
live chat