开发者

Plus icon not appearing in the first column of a jqgrid with a subgrid!

I've got an interesting issue with creating a subgrid in the excellent jqGrid plugin. The main grid is working fine itself. However, when I add the parameters to create the subgrid, I get the new first column but do not get the plus sign. When I inspect the demo using Firebug I see that an href and several classes are added to the first column. I do not see those classes in the first column of my grid. Here's the code:

$("#quotelist").jqGrid({
    datatype:'xml',
    url:'getQuotes',
    mtype: 'GET',
    postData:{"a":$("#AccountNumber").val(),
        "op":"y",
        "cl":"n",
        "cd":"All",
        "eq":"All",
        "sess":$("#SessionID").val(),
        "d":new Date().getTime()
    },
    colNames:['Origin Zip', 'Destination Zip', 'Equipment', 'Commodity'],
    colModel:[
        {name:'ozip', index:'ozip', title:false, width:140},
        {name:'dzip', index:'dzip', title:false, width:40},
        {name:'equipment', index:'equipment', title:false, width:40},
        {name:'commodity', index:'commodity', title:false, width:40}
    ],
    loadError:function(xhr, st, err) {
        alert('loaderror on quote request grid - ' + st)
    },
    pager:'#pager',
    height: 550,
    width: 425,
    rowNum: -1,
    hidegrid: false,
    gridview: true,
    gridstate:'hidden',
    viewrecords: true,
    altRows: true,
    sortname: 'ozip',
    sortorder: 'asc',
    caption: 'Carriers',
    subGrid:true,
    subGridUrl:"getQuoteResponse&a="+$("#AccountNumber").val() +
               "&sess=" + $("#SessionID").val(),
    subGridModel: [
        {name:['Carrier Name','Status'], width:[200,100]}
    ]
});

Other information: I included the 'pager' to make sure the icons appear on the pager - they do. I've tried this on jqGrid versions 3.8.2 and 3.6.5 with the same result. jQuery version is 1.4.2, jquery UI version 1.8.2.

I think that the plus isn't appearing because I'm not getting the new classes in the first column开发者_如何学JAVA when the grid loads, but I have no idea why not. It's weird that the first column appears when subGrid is set to true but then the plus sign isn't loaded.

Any idea? Many thanks for any suggestions!

edit: nevermind! I was editing this post to fix some formatting and found the problem. Too many parameters about hidegrid, gridview, etc. Those were left over from my initial experimentation with jqGrid.


The main problem is that gridview:true can not be used in your case. In the description of the gridview option in the documentation you will find

If set to true we can not use treeGrid, subGrid, or afterInsertRow event.


I gone through the same problem when I was working with jQuery Grid. In my case plus icon is not appearing but when I clicked on first column cell my subgrid appear. After searching for hour I finally got solution. In ui.jqgrid.css file include this code.

.ui-icon-plus {
height: 10px;
width: 10px;
background-image: url('../../Images/plus.gif');

}

.ui-icon-minus {
height: 10px;
width: 10px;
background-image: url('../../Images/minus.gif');

}

Image path will be your Image path. I am not giving height and width of image that's why I am not able to see in UI. Hope this help.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜