简体   繁体   English

jqGrid的。 无法创建删除按钮

[英]jqGrid. Can't create delete button

I use * jqGrid 5.1.0 我使用* jqGrid 5.1.0
i find documentation. 我找到了文档。 http://www.trirand.com/jqgridwiki/doku.php?id=wiki:custom_buttons It's rather easy by docs, but after adding such code, my jqGrid don't add buttons. http://www.trirand.com/jqgridwiki/doku.php?id=wiki:custom_buttons这是相当容易的文档,但添加这样的代码后,我的jqGrid不添加按钮。 There are no mistakes in console. 控制台没有错误。 Also, last extra col for this button don't appears. 此外,此按钮的最后一个额外col不会出现。 I will be grateful for the help 我将非常感谢你的帮助

$("#list").jqGrid({
    url: "/backend.php",
    datatype: "xml",
    mtype: "POST",
    colNames: ["Клиент", "id", "Адрес", "Дата", "Время", "Водитель","Оборудование", "Примечание"],
    colModel: [
        { name: "name", width: 80, align: "center", editable: true, sorttype:'string', searchoptions:{sopt:['eq','bw','bn','cn','nc','ew','en']}},
        { name: "order_id", width: 80, align: "center", sorttype:'integer', searchoptions:{sopt:['eq','ne','le','lt','gt','ge']}},
        { name: "address", width: 160, align: "center", editable: true },
        { name: "date", width: 80, align: "center", editable: true },
        { name: "time", width: 80, align: "center", editable: true },
        { name: "driver", width: 80, align: "center", editable: false },
        { name: "equip", width: 100, align: "center", editable: true },
        { name: "notice", width: 80, align: "center", editable: true },
    ],
    pager: "#pager",
    rowNum: 10,
    rowList: [10, 20, 30],
    viewrecords: true,
    onSelectRow: function(id){ if(id && id!==lastsel && lastsel!=0){ jQuery('#list').jqGrid('saveRow',lastsel); jQuery('#list').jqGrid('editRow',id,true); lastsel=id; }else{ if(lastsel==0){ jQuery('#list').jqGrid('editRow',id,true); lastsel=id; } } },
    editurl: "/iwater/backend.php",
    gridview: true,
    autoencode: false,
    caption: "Заказы",
    loadonce: true,
    sortable:true
});
$("#list").jqGrid('navGrid',"#pager",{edit:false,add:false,del:false}).navButtonAdd('#pager',{
    caption:"Del",
    buttonicon:"ui-icon-del",
    onClickButton: function(){
        alert("Deleting Row");
    },
    position:"last"
});
$("#list").jqGrid('filterToolbar',{searchOperators : true});
$("#list").jqGrid('setGridHeight',300);

The option buttonicon:"ui-icon-del" is wrong. 选项buttonicon:"ui-icon-del"错误。 The value should be one from jQuery UI CSS Framework Icons (see here for details). 该值应该是jQuery UI CSS Framework Icons中的值(有关详细信息,请参见此处 )。 I suppose that you wanted to use the name ui-icon-trash instead of ui-icon-del . 我想您想使用名称ui-icon-trash而不是ui-icon-del

Depend on other parts of your code, the call .navButtonAdd('#pager',{... could be illegal too. The call in the form .jqGrid('navButtonAdd','#pager',{... works always. 依赖于代码的其他部分,调用.navButtonAdd('#pager',{...也可能是非法的。调用形式为.jqGrid('navButtonAdd','#pager',{...始终有效) 。

Finally I want to mention that jqGrid 5.1.0 is Guriddo jqGrid JS, which is commercial product available for the prices found here . 最后我想提一下jqGrid 5.1.0是Guriddo jqGrid JS,这是一个商业产品,可以在这里找到价格。 Free jqGrid is alternative fork of jqGrid which I develop and which is available under old MIT/GPL-licenses completely free of charge. 免费的jqGrid是我开发的jqGrid替代分支,它可以完全免费获得旧的MIT / GPL许可证。 You can consider to use it instead of jqGrid 5.1.0. 您可以考虑使用它而不是jqGrid 5.1.0。 I suppose that your current code is full compatible with free jqGrid. 我想你的当前代码与免费的jqGrid完全兼容。 You can try it by usage URLs to jqGrid files directly from CDN (see the wiki article ). 您可以直接从CDN使用URL到jqGrid文件来尝试它(请参阅wiki文章 )。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM