开发者

How to avoid scroll to top, when i click on any Non-Editable Cell in JQGrid subgrid...?

开发者 https://www.devze.com 2023-04-12 22:31 出处:网络
I\'m using Cell Editing for a sub-grid in JQGrid. When I set height of sub-grid to auto, By clicking on non editable cell, Grid sc开发者_如何学编程roll back to top.

I'm using Cell Editing for a sub-grid in JQGrid.

When I set height of sub-grid to auto, By clicking on non editable cell, Grid sc开发者_如何学编程roll back to top.

And when i set height to be specific like 180 or something, That way, it does not scrolls to top. Selected cell remains in same position.

If i need to make height auto, How should i avoid scrolling back to top?

$("#listsg11").jqGrid({
url:'Any URL',
datatype: "json",
height: 190,
colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'],
colModel:[
    {name:'id',index:'id', width:55},
    {name:'invdate',index:'invdate', width:90},
    {name:'name',index:'name', width:100},
    {name:'amount',index:'amount', width:80, align:"right"},
    {name:'tax',index:'tax', width:80, align:"right"},      
    {name:'total',index:'total', width:80,align:"right"},       
    {name:'note',index:'note', width:150, sortable:false}       
],
sortname: 'id',
viewrecords: true,
sortorder: "desc",
multiselect: false,
subGrid: true,
caption: "Grid as Subgrid",
subGridRowExpanded: function(subgrid_id, row_id) {
    var subgrid_table_id, pager_id;
    subgrid_table_id = subgrid_id+"_t";

    $("#"+subgrid_id).html("<table id='"+subgrid_table_id+"' class='scroll'></table><div id='"+pager_id+"' class='scroll'></div>");
    jQuery("#"+subgrid_table_id).jqGrid({
        url:'Any URL with parameters',
        datatype: "json",
        colNames: ['No','Item','Qty','Unit','Line Total'],
        colModel: [
            {name:"num",index:"num",width:80,key:true},
            {name:"item",index:"item",width:130,editable:true},
            {name:"qty",index:"qty",width:70,align:"right",editable:true},
            {name:"unit",index:"unit",width:70,align:"right",editable:false},
            {name:"total",index:"total",width:70,align:"right",sortable:false}
        ],
        cellEdit: true,
        cellsubmit: 'clientArray',
            height: 'auto'
    });

} });

Thanks in advance.


I'm using subgrids as grid, Same like given example in your link, And following is an example code in which I've made changes to re-produce the problem. I do not use pager div in any of my grids. And I've set height of Subgrid as 'auto'

When you click on any non editable CELL in last row of subgrid. Sub-grid should navigate back to top, But not my selected cell

Note: Subgrid data should be more than 30 rows approx.

Thanks

0

精彩评论

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

关注公众号