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

查看:22
本文介绍了从服务器加载 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 中)可以有一些通用值,例如 "c1""c2""c3" ...来自服务器的响应可以包含colModel信息和数据.在 beforeProcessing 回调中,您可以更改 colModel 并设置新的列标题.答案演示了动态设置列标题.使用 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天全站免登陆