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
storage query result into jqGrid object when use local data
05/11/2013
17:39
Avatar
belha
france
Member
Members
Forum Posts: 6
Member Since:
17/09/2013
sp_UserOfflineSmall Offline

Hello,

i know that jqGrid isn't optimized to be used with local data. But in my case, I use local data. to be more faster, I had a variable which stores result when I sort ou filter my grid. Is it possible to implement it, in the futur version of jqGrid for people like me which used local data.Embarassed

below the code that I could add (in red)

$.fn.jqGrid = function( pin ) {
    if (typeof pin === 'string') {
        var fn = $.jgrid.getMethod(pin);
        if (!fn) {
            throw ("jqGrid - No such method: " + pin);
        }
        var args = $.makeArray(arguments).slice(1);
        return fn.apply(this,args);
    }
    return this.each( function() {
        if(this.grid) {return;}

        var p = $.extend(true,{
            url: "",
            height: 150,
            page: 1,
            rowNum: 20,
            rowTotal : null,
            records: 0,
            pager: "",
            pgbuttons: true,
            pginput: true,
            colModel: [],
            rowList: [],
            colNames: [],
            sortorder: "asc",
            sortname: "",
            allQueryResults: null,
            datatype: "xml",

in addJSONData

addJSONData = function(data,t, rcnt, more, adjust) {
           ...

            ts.p.lastpage = lp === undefined ? 1 : lp;
            ts.p.records = $.jgrid.getAccessor(data,dReader.records) || 0;
            ts.p.userData = $.jgrid.getAccessor(data,dReader.userdata) || {};
            ts.p.allQueryResults = $.jgrid.getAccessor(data,dReader.allQueryResults) || {};

in addLocalData

         
var svgAllQueryResults = queryResults;
            queryResults = queryResults.slice( (page-1)*recordsperpage , page*recordsperpage );
            query = null;
            cmtypes = null;
            retresult[ts.p.localReader.total] = totalpages;
            retresult[ts.p.localReader.page] = page;
            retresult[ts.p.localReader.records] = total;
            retresult[ts.p.localReader.root] = queryResults;
            retresult[ts.p.localReader.userdata] = ts.p.userData;
            retresult[ts.p.localReader.allQueryResults] = svgAllQueryResults;
            queryResults = null;
            return  retresult;

ts.p.localReader = $.extend(true,{
            root: "rows",
            page: "page",
            total: "total",
            records: "records",
            repeatitems: false,
            cell: "cell",
            id: "id",
            allQueryResults: "allQueryResults",
            userdata: "userdata",
            subgrid: {root:"rows", repeatitems: true, cell:"cell"}
        },ts.p.localReader);

Regards

Belha

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
45 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