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
sortGrid calls sortData with colname rather than a header index
16/04/2009
05:41
Avatar
dgallop
New Member
Members
Forum Posts: 1
Member Since:
16/04/2009
sp_UserOfflineSmall Offline

The sortGrid function in grid.custom.js takes a colname and if this column is sortable calls sortData as follows:

$t.sortData(colname, idx, reload);

However sortData requires an index (in the form jqgh_ + colname) to be able to re-apply the sort image and correctly set the sortname.

Here is a snippet form the sortData code that relies on the index having 'jqgh_' as a prefix to the colname.

$("tr th div#jqgh_"+ls+" img",thd).remove();
$("tr th div#jqgh_"+ls,thd).parent().removeClass(ts.p.sortclass);
iId = index.replace('.',"\\\\.");
$("tr th div#"+iId,thd).append(imgs).parent().addClass(ts.p.sortclass);
ts.p.lastsort = idxcol;
index = index.substring(5);
ts.p.sortname = ts.p.colModel[idxcol].index || index;
so = ts.p.sortorder;
if(onSortCol) {onSortCol(index,idxcol,so);}

 You can see that the image is removed along with the class using an id of jqgh_ + a column name. However if the index passed into sortData does not have jqgh_ as a prefix (as it does when called from other parts of grid.base.js) the sorting does not work.

My fix to this has been to alter sortGrid function in grid.custom.js to the following:

sortGrid : function(colname,reload){
        return this.each(function(){
            var $t=this,idx=-1;
            if ( !$t.grid ) { return;}
            if ( !colname ) { colname = $t.p.sortname; }
            for ( var i=0;i<$t.p.colModel.length;i++ ) {
                if ( $t.p.colModel[i].index == colname || $t.p.colModel[i].name==colname ) {
                    idx = i;
                    break;
                }
            }
            if ( idx!=-1 ){
                var sort = $t.p.colModel[idx].sortable;
                if ( typeof sort !== 'boolean' ) { sort =  true; }
                if ( typeof reload !=='boolean' ) { reload = false; }
                /* David Gallop 5/3/2009
                 * The colname expected by the sortData function
                 * in grid_base.js requires a prefix of jqgh_
                 * as it is used as an id to the grid header
                 */
                if ( sort ) { $t.sortData('jqgh_' + colname, idx, reload); }
            }
        });
    },

Please could this fix be included in future releases.

best regards and keep up the good work, Dave.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
40 Guest(s)

Currently Browsing this Page:
2 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