0

我的 jqgrid 有一个大问题,其中搜索和工具栏搜索都不起作用这是我的代码:

$("#str_container-uiId").jqGrid({ xmlReader: { root:"structure_object", row:"node_structure", repeatitems:false, id : "node_id" }, treeReader: { level_field: "structure>level", parent_id_field: "structure>parent_id", leaf_field: "structure>leaf", expanded_field: "structure>expand" }, treeGrid: true, treeGridModel: 'adjacency', ExpandColumn: 'reference', ExpandColClick : true, url: '/audros/html/test4.xml', datatype: 'xml', mtype: 'GET', postData: { objectID: function() { return current_id; } }, colNames: ["id","hiddenID","className", "reference","","Qty","Class","Att","Verrou", "Ver.","Rev","Désignation","Modifié le","Status"], colModel: [{name:'id',index:'id', width:1,key:true,hidden:true,xmlmap:"node_id"}, {name:'hiddenID',index:'hiddenID', width:1,hidden:true,xmlmap:getNodeId}, {name: 'className',index: 'className',width: 1,hidden: true,xmlmap:"obj_classname"}, {name: 'reference',index: 'reference',width: 25,xmlmap:getRefLabel}, {name: 'linkName', index: 'linkName',width: 5, align: 'left',editable: true,hidden: false,xmlmap:function (obj) {return getLink(obj,"linkName"); }}, {name: 'qty', index: 'qty',width: 3,editable: true,xmlmap:"structure>str_qty"}, {name: 'classLabel',index: 'classLabel',width: 20,xmlmap:getClass}, {name: 'attachment',index: 'attachment',width: 5,xmlmap:getAttachment}, {name: 'verrou',index: 'verrou',width: 5,xmlmap:getVerrou}, {name: 'version',width: 3,xmlmap:"obj_version"}, {name: 'release',width: 3,xmlmap:"obj_release"}, {name: 'description',width: 10, editable:true,xmlmap:"obj_description"}, {name: 'modifDate',width: 17, editable:true,xmlmap:"obj_modificationdate"}, {name: 'statusLabel',width: 10, editable:true,xmlmap:"obj_status_label"} ],

                    gridComplete: function(){
                        $('.jqgrow').addClass('objClassName');

                        $("#str_container-uiId").trigger("reloadGrid");
                    },
                    cellEdit: true,
                    height: 'auto',
                    width: 1284,
                    pager: '#ptoolbar',
                    viewrecords: true,
                    multiselect: false

                })

$("#str_container-uiId").jqGrid('navGrid','#ptoolbar',{del:false,add:false,edit:false,search:true});
                $("#str_container-uiId").jqGrid('filterToolbar',{stringResult: true,searchOnEnter : false});

我可以看到区域 creteria 但是当我输入字符时没有任何反应,如果我在选择 creteria 时单击搜索 btn 也没有任何反应。treegrid 可以与搜索和工具栏搜索一起使用吗???请帮助

4

1 回答 1

0

好吧,原始 treegrid 不提供搜索选项。但是您可以像这样编写自己的自定义导航搜索按钮:

$("#grid").jqGrid('navButtonAdd', "#pagerid", {        // grid - your grid name, pagerid - your pager name
caption: "", title: "Search", buttonicon: "ui-icon-search",
onClickButton: function () {
    $("#grid").searchGrid({
        closeOnEscape: true,
        searchOnEnter: true,
        width:500,
        closeAfterSearch: true,
        sopt: ['eq','ne','lt','gt','cn','nc','bw','ew'],
        onSearch: function(){
            rowName = $('#fbox_grid .columns select'); //search field
            operator = $('#fbox_grid .selectopts');    //search option
            needle = $('#fbox_grid .data input');      //search argument
            /*some code to work with searchoptions*/
        }  
    }
}

}

您必须根据需要编写自己的搜索功能。

于 2013-09-06T08:10:54.063 回答