从服务器加载jqGrid的结构,不仅数据 [英] Load jqgrid structure from server, not only data

查看:197
本文介绍了从服务器加载jqGrid的结构,不仅数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能从服务器通过AJAX jqGrid的结构(列)以及数据加载? 如果可能的话,请你展示一个例子?

Is it possible to load from server via ajax JQGrid structure(columns) together with data ? If possible, could you please show an example ?

推荐答案

您可以与所有的隐藏的列上创建jqGrid的。你需要有足够大的列数创建网格。该列的名称(在 colModel )可以有一些通用的值,例如C1C2C3 ...来自服务器的响应可以包含 colModel 信息与数据一起。在 beforeProcessing 的回调可以更改 colModel ,并设置新的列标题。 动态演示列标题的设置答案。在code柱通过使用 setLabel 方法简化。 另一个答案演示如何使用 setColProp 设置的大多数设置 colModel 全动态。如果你想结合的解决方案, setColWidth 的方法,我张贴在的回答(见这里太),那么你可以创建完美的解决方案。

You can create jqGrid with all hidden columns. You need create grid with large enough number of columns. The names of the columns (in colModel) can have some generic values like "c1", "c2", "c3" ... The response from the server can contains colModel information together with the data. Inside of beforeProcessing callback you can change colModel and set new column headers. The answer demonstrates setting of column headers dynamically. The code column be simplified by usage setLabel method. Another answer demonstrates how to use setColProp to set the most settings of colModel full dynamically. If you would combine the solution with the usage of setColWidth method which I posted in the answer (see here too) then you could create perfect solution.

这篇关于从服务器加载jqGrid的结构,不仅数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆