Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
achieve rowspan ,using pager
08/08/2014
11:22
Avatar
ss
New Member
Members
Forum Posts: 2
Member Since:
19/05/2014
sp_UserOfflineSmall Offline

Hi,

 

I have a jqGrid table with rowspan attribute set.It renders fine, if I am on the same page.As soon as I change the page,rendering is lost i.e. doesn't display data correctly.Please help me to achieve rowspan across pages.

 

My code :

 $(function () {
        
         //]]>
    
    
            'use strict';
var prevCellVal = { cellId: undefined, value: undefined };
var prevCell1Val = { cellId: undefined, value: undefined };
var prevCell2Val = { cellId: undefined, value: undefined };
            var mydata =[{
    "email": "abc.def@abc.com",
    "name": "abc, def",
    "address": "USA"
    
},
{
    "email": "abc.dFef@abc.com",
    "name": "abSFc, def",
    "address": "USA"
},
{
    "email": "awwwwwwwwwwwwwbc.def@abc.com",
    "name": "abc, def",
    "address": "USA"
},
{
    "email": "abwwwwwwwwwwwwDc.def@abc.com",
    "name": "aDbc, def",
    "address": "UK"
},
{
    "email": "FEabc.def@abc.com",
    "name": "FDabc, def",
    "address": "UK"
},
{
    "email": "abDc.def@abc.com",
    "name": "abc, def",
    "address": "UK"
},
{
    "email": "aDbc.def@abc.com",
    "name": "aDbc, def",
    "address": "UK"
},
{
    "email": "abc.def@abc.com",
    "name": "abc, def",
    "address": "USA"
},
{
    "email": "abwefwec.def@abc.com",
    "name": "abwqewfdec, def",
    "address": "USA"
},
{
    "email": "awfwfwbc.def@abc.com",
    "name": "awvferbc, def",
    "address": "USA"
},
{
    "email": "awwwwwwwwwwwwwwwwbc.def@abc.com",
    "name": "abwvfwc, def",
    "address": "USA"
}];
                       
            $("#list").jqGrid({
                datatype: 'local',
                data: mydata,
                colNames: ['Email', 'Name', 'Address'],
               colModel: [
        { name: 'email', width: 70, align: 'center',
         
                        cellattr: function (rowId, val, rawObject, cm, rdata) {
                            var result;

                            if (prevCellVal.value == val) {
                                result = ' style="display: none" rowspanid="' + prevCellVal.cellId + '"';
                            }
                            else {
                                var cellId = this.id + '_row_' + rowId + '_' + cm.name;

                                result = ' rowspan="1" id="' + cellId + '"';
                                prevCellVal = { cellId: cellId, value: val };
                            }

                            return result;
                        }
        },
        { name: 'name', width: 80, align: 'center',

                        cellattr: function (rowId, val, rawObject, cm, rdata) {
                            var result;

                            if (prevCell1Val.value == val) {
                                result = ' style="display: none" rowspanid="' + prevCell1Val.cellId + '"';
                            }
                            else {
                                var cellId = this.id + '_row_' + rowId + '_' + cm.name+$('#list').jqGrid.getGridParam('page');

                                result = ' rowspan="1" id="' + cellId + '"';
                                prevCell1Val = { cellId: cellId, value: val };
                            }

                            return result;
                        }
                     },
        { name: 'address', width: 90,

                       cellattr: function (rowId, val, rawObject, cm, rdata) {
                            var result;

                            if (prevCell2Val.value == val) {
                                result = ' style="display: none" rowspanid="' + prevCell2Val.cellId + '"';
                            }
                            else {
                                var cellId = this.id + '_row_' + rowId + '_' + cm.name+$('#list').jqGrid.getGridParam('page');

                                result = ' rowspan="1" id="' + cellId + '"';
                                prevCell2Val = { cellId: cellId, value: val };
                            }

                            return result;
                        }}
       
    ],
           rowList:[5,10,20],
rowNum:5,
           pager: '#pager',
    
    gridview: true,
    viewrecords: true,
    height: '100%',
    caption: 'Grid with rowSpan attributes',

    beforeSelectRow: function () {
        return false;
    },
   gridComplete: function () {
                var grid = this;

                $('td[rowspan="1"]', grid).each(function () {
                    var spans = $('td[rowspanid="' + this.id + '"]', grid).length + 1;

                    if (spans > 1) {
                        $(this).attr('rowspan', spans);
                    }
                });
            }
});
//$("#list").jqGrid('navGrid','#pager',{edit:false,add:false,del:false,reload:true}).trigger('reloadGrid');;
    // $('#jQGridDemo').jqGrid('navGrid', '#jQGridDemoPager',
});
  

 

HTML is :

....

<body>
<table id="list"><tr><td /></tr></table>
<div id="pager"></div>
</body>

...

 

Please help me with this.Appreciate your help!

 

Thanks,

SS

Forum Timezone: Europe/Sofia

Most Users Ever Online: 496

Currently Online:
16 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

OlegK: 1255

markw65: 179

kobruleht: 144

phicarre: 132

YamilBracho: 124

Renso: 118

Member Stats:

Guest Posters: 447

Members: 11373

Moderators: 2

Admins: 1

Forum Stats:

Groups: 1

Forums: 8

Topics: 10592

Posts: 31289

Newest Members:

, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information