jqgrid 如何在编辑状态下(Edit)给下拉框(select)赋值,而这个值是从另一个表里异步查出来的。
2012-02-25 21:48
225 查看
先不多说看代码:
colModel:[
{name:'userId',width:90,editable:true,edittype:'select',editrules:{required:true},editoptions:{value:getSelectNames("user")}},
],
比如说 有这样一个列 edittype是 select ,那他的数据是从 表里拿出来的 。这样
在getSelectNames("user")里写方法吧
function getSelectNames(type){
var data;
if(type=="user"){
$.ajax({url:"servlet/SampleSelecte?type=user",async:false, success:function(e){
if (e != null) {
data = e;
}
}});
}
return data;
}
一定要有 返回值。而且 你的返回值 是符合jqgrid 对select 值得规定的 字符串,而且 一定要用同步的ajax 操作。不然这样没任何效果
,也就是 async:false 这个属性
懂了吧 了解吧。。容易吧s
colModel:[
{name:'userId',width:90,editable:true,edittype:'select',editrules:{required:true},editoptions:{value:getSelectNames("user")}},
],
比如说 有这样一个列 edittype是 select ,那他的数据是从 表里拿出来的 。这样
在getSelectNames("user")里写方法吧
function getSelectNames(type){
var data;
if(type=="user"){
$.ajax({url:"servlet/SampleSelecte?type=user",async:false, success:function(e){
if (e != null) {
data = e;
}
}});
}
return data;
}
一定要有 返回值。而且 你的返回值 是符合jqgrid 对select 值得规定的 字符串,而且 一定要用同步的ajax 操作。不然这样没任何效果
,也就是 async:false 这个属性
懂了吧 了解吧。。容易吧s
相关文章推荐
- jqgrid 如何在编辑状态下(Edit)给下拉框(select)赋值,而这个值是从另一个表里异步查出来的。
- jqgrid 如何给下拉框(select)赋值,而这个值是从另一个表里查出来的。
- jqgrid 如何给下拉框(select)赋值,而这个值是从另一个表里查出来的。(
- MySql update inner join!MySql跨表更新 多表update sql语句?如何将select出来的部分数据update到另一个表里面?
- MySql update inner join!MySql跨表更新 多表update sql语句?如何将select出来的部分数据update到另一个表里面?
- MySql update inner join!MySql跨表更新 多表update sql语句?如何将select出来的部分数据update到另一个表里面?
- Excel中,如何在cell处于编辑状态时,对其用代码赋值
- android 如何实现EditText从不可编辑状态变成可变成可编辑状态
- MySql update inner join!MySql跨表更新 多表update sql语句?如何将select出来的部分数据update到另一个表里面?
- Flex中如何给DataGrid控件的项目添加一个可编辑TextArea/TextInput,单击控件内的项目时,自动进入编辑状态
- jq点击select下拉框选中状态触发时间
- 如何从后台子shell中把状态传出来
- jSON学习拓展:如何把一个json对象赋值给另一个json数组?
- struts2.0 select标签 如何设置下拉框默认值
- 当EditText编辑时 hint 在 6.0 手机上显示不出来
- jquery操作select下拉框的多种方法(选中,取值,赋值等)
- 如何设置select只读不可编辑且select的值可传递
- 如何设置select只读不可编辑且select的值可传递
- jquery操作select下拉框的多种方法(选中,取值,赋值等)
- EditText 不可编辑状态的实现