Load jqgrid structure from server, not only data(从服务器加载 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 结构,不仅是数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:从服务器加载 jqgrid 结构,不仅是数据
基础教程推荐
- 在 contenteditable 中精确拖放 2022-01-01
- fetch 是否支持原生多文件上传? 2022-01-01
- npm start 错误与 create-react-app 2022-01-01
- 原生拖动事件后如何获取 mouseup 事件? 2022-01-01
- Fabric JS绘制具有活动形状的多边形 2022-01-01
- Bokeh Div文本对齐 2022-01-01
- Bootstrap 模态出现在背景下 2022-01-01
- 检查 HTML5 拖放文件类型 2022-01-01
- 如何添加到目前为止的天数? 2022-01-01
- 即使用户允许,Gmail 也会隐藏外部电子邮件图片 2022-01-01
