如何通过 JavaScript/Ajax 代码管理 Infragistics WebGrid 数据?

发布于 2024-07-07 10:18:01 字数 302 浏览 7 评论 0原文

我正在开发一个项目,需要对某些数据列表使用 Infragistics WebGrid 控件。 我使用 JavaScript 在客户端加载数据以在地图上显示,然后我需要在多个 WebGrid 中显示相同的数据。 所有可用的数据都将显示在 WebGrid 中,但在任何给定时间,只有数据的子集(仅当前在视图中的数据)将绘制在地图上。 由于我使用 JavaScript/Ajax 加载数据,因此我只想加载一次,并使用相同的机制用数据填充 WebGrid 控件。

是否有人对完全从客户端 JavaScript/Ajax 代码中使用 WebGrid 有任何提示/指示?

I am working on a project that I need to use the Infragistics WebGrid control for some lists of data. I am loading the data on the client-side using JavaScript for display on a Map, and then I need to display that same data within multiple WebGrids. All the data available will be displayed in the WebGrids, but only a subset of the data (only that which is currently within view) will be plotted on the Map at any given time. Since I am loading the data using JavaScript/Ajax, I would like to only load it once, and use the same mechanism to populate the WebGrid control with data too.

Does anyone have any tips/pointers on working with the WebGrid completely from within client-side JavaScript/Ajax code?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

咆哮 2024-07-14 10:18:01

Infragistics webgrids 公开了一个非常复杂的客户端对象模型,您将能够使用它来填充数据客户端。

您要做的第一件事是查看 webgrid 控件的完整 CSOM,您可以在以下位置找到当前的文档版本: http://help.infragistics.com/NetAdvantage/NET/2008.3/CLR2.0/

要制作一个简短的示例,您需要获取一个参考到您的网格,然后添加一些行和数据。 在设计时为网格设置列定义可能会更容易,而不是尝试在 JavaScript 中完成这一切。

首先:获取网格的引用:

var grid = igtbl_getGridById('dataGridControlID');

然后添加一个新行:

var newRow = grid.Rows.addNew()

完成后,您可以循环行的列来填充数据:

var oCols = newRow.Band.Columns;
for(var i=0; i < oCols.length; i++) {
    newRow.getCell[i].setValue(yourValue)
}

或通过键寻址每个列以填充其数据:

newRow.getCellFromKey(colKey).setValue(yourValue,fireEvents);

The Infragistics webgrids expose a very complex client side object model that you will be able to use to populate your data client side.

The first thing you will want to do is get a look at the full CSOM for the webgrid control, you can find the current doc version at: http://help.infragistics.com/NetAdvantage/NET/2008.3/CLR2.0/

To make a short example, you will need to grab a refence to your grid(s) and then add some rows and data. It would probably be easier to setup the column definitions for your grids at design time, rather than try to do it all in the javascript.

First: get a refrence to your grid:

var grid = igtbl_getGridById('dataGridControlID');

Then add a new row:

var newRow = grid.Rows.addNew()

After thats done you can loop the columns of your row to fill the data:

var oCols = newRow.Band.Columns;
for(var i=0; i < oCols.length; i++) {
    newRow.getCell[i].setValue(yourValue)
}

or address each one by key to populate its data:

newRow.getCellFromKey(colKey).setValue(yourValue,fireEvents);
泪冰清 2024-07-14 10:18:01

我想到的唯一想法是与性能相关。 我们发现为 UltraWebGrid 动态创建和填充行比我们希望的要慢得多。 (在我们的例子中,我们将行从一个网格移动到另一个网格,当行数太大时会遇到性能问题。)

如果我正在做像您今天描述的那样的事情,如果可能的话,我会从服务器端填充网格,然后在地图上显示相关值。

作为附加免责声明,我们使用了 Infragistics 2007.1; 我不知道2008.x在这方面是否更好。

The only thought that comes to mind is performance-related. We found that dynamically creating and populating rows for an UltraWebGrid was appreciably slower than we would have liked. (In our case we were moving rows from one grid to another and hit performance issues when the number of rows was too great.)

If I was doing something like you describe today, I would populate the grid from the server side if at all possible, and the display the relevant values on the Map from there.

As an added disclaimer, we used Infragistics 2007.1; I do not know if 2008.x is better in this area.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文