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为需要编辑的行号

var width = $(window).width()-80

var height = $(window).height()-120

stView_layout = $('#stView_layout').layout({

width: width,

height: height

})

station_view = $('#stationView').window({

title: '测站导航',

left:50,

top:80,

width: width,

modal: false,

shadow: false,

closed: true,

height: height,

onResize:function(w,h){

if(stView_treegrid){

stView_treegrid.treegrid({

width:w-20,

height:h-260

})

}

}

})

js 中添加 直接在定义datagrid 的时候加上 toolbar 属性

toolbar: ["-", {

id: '',

text: '',

iconCls: '',

handler: function () {}

}, "-", {

id: '',

text: '',

iconCls: '',

handler: function () { }

}, "-", {

id: '',

text: '',

iconCls: '',

handler: function () { }

}, "-"]

第二种方法是在页面些个div 在里面可以放入 按钮 输入框 搜索框 之类的 并且给这个div 设置一个 id 然后再定义 datagrid 的地方写 toolbar:"#div的id"


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

原文地址:https://54852.com/bake/11267065.html

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

发表评论

登录后才能评论

评论列表(0条)

    保存