jqueryeasyui单击按钮表格增加可编辑一行的代码应该怎么写?项目卡一天了

jqueryeasyui单击按钮表格增加可编辑一行的代码应该怎么写?项目卡一天了,第1张

首先,为需要编辑的列设置编辑器

例如:

{field:'F1',title:'编辑咧列',width:100,align:'center',

editor: {

type: 'numberbox',

options: {

min:1

}

}

}

第二步,按钮点击事件中添加代码

$('#dg').datagrid('appendRow',{

F1: '新名称'

})

三,开启编辑列

$('#dg').datagrid("beginEdit", i)//i为需要编辑的行号

**

 * 创建添加或编辑窗口

 * 

 * @param title

 * @param addurl

 * @param saveurl

 */

function createwindow(title, addurl,width,height) {

width = width?width:700

height = height?height:400

if(width=="100%" || height=="100%"){

width = document.body.offsetWidth

height =document.body.offsetHeight-100

}

if(typeof(windowapi) == 'undefined'){

$.dialog({

content: 'url:'+addurl,

lock : true,

width:width,

height:height,

title:title,

opacity : 0.3,

cache:false,

    ok: function(){

     iframe = this.iframe.contentWindow

saveObj()

return false

    },

    cancelVal: '关闭',

    cancel: true /*为true等价于function(){}*/

})

}else{

W.$.dialog({

content: 'url:'+addurl,

lock : true,

width:width,

height:height,

parent:windowapi,

title:title,

opacity : 0.3,

cache:false,

    ok: function(){

     iframe = this.iframe.contentWindow

saveObj()

return false

    },

    cancelVal: '关闭',

    cancel: true /*为true等价于function(){}*/

})

}

}

Ok:获取到Iframe的obj,就能 *** 作winA里面方法(如果你能看的懂这段代码的话……)

$("#"+id).datagrid("reload")......刷新datagrid的方法


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/bake/11228643.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-14
下一篇 2023-05-14

发表评论

登录后才能评论

评论列表(0条)

保存