作法:jqGrid依存选择框以行显示值 [英] How to: jqGrid dependent select box display values in rows

查看:105
本文介绍了作法:jqGrid依存选择框以行显示值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在jqGrid中实现了依赖下拉列表(类似于此示例 ).返回的行数据具有值和显示值.如何显示网格行上的显示值?在网格初始化时,我没有相关下拉列表的值列表,当用户从其他下拉列表中选择值时,它们将从服务器加载. formatter: 'select'当我知道从属下拉列表的值时会有所帮助,但是我不确定在动态加载值时如何使用它.

I have implemented dependent dropdowns in jqGrid (similar to this example). The row data returned has values as well as display values. How can I show display values on grid rows? At grid initialization time I do not have list of values for dependent dropdowns, they get loaded from the server when user selects value from other dropdown. formatter: 'select' helps when I know the values of dependent dropdown but I am not sure how to use it when the values are loaded dynamically.

推荐答案

如果要从服务器加载数据,只需在 formatter: "select"开始之前设置editoptions.valueformatoptions.value 处理数据.例如,您可以使用beforeProcessing回调.它将在您需要的时候被调用.您可以在服务器响应的userdata部分或任何其他位置使用editoptions.value放置信息. beforeProcessing回调的data参数(第一个参数)包含 all 来自服务器响应的数据.因此,您可以轻松获取所需的数据并使用setColProp例如更改formatter: "select"使用的选项.我建议您阅读答案以获取相应的代码示例.

In case of loading the data from the server you need just set editoptions.value or formatoptions.value before formatter: "select" start to process the data. You can use beforeProcessing callback for example. It will be called at the moment which you need. You can place the information with editoptions.value in userdata part of the server response or in any other place. The data parameter (the first parameter) of beforeProcessing callback contains all the data from the server response. So you can easy get the required data and to use setColProp for example to change the options used by formatter: "select". I recommend you to read the answer for the corresponding code example.

这篇关于作法:jqGrid依存选择框以行显示值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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