Enrico Stahn

07 Feb, 2007

yui-ext: Field names instead of column id’s

Posted by: Enrico Stahn In: Software Development

You’re using the Grid of yui-ext and you’re loading the data with XMLDataModel, JSONDataModel or any other kind of LoadableDataModel, right? Well, did you tried to use the remoteSort configuration and got worried about this feature as you’re recognize it sends the column index instead of the field name?

Instead of rewrite parts of yui-ext, use the following code after you’ve loaded yui-ext. Now, you should get the field name.

YAHOO.ext.grid.LoadableDataModel.prototype.createParams = function(pageNum, sortColumn, sortDir) {
        var params = {}, map = this.paramMap;
        for(var key in this.baseParams){
            if(typeof this.baseParams[key] != 'function'){
                params[key] = this.baseParams[key];
            }
        }
        params[map['page']] = pageNum;
        params[map['pageSize']] = this.getPageSize();
        params[map['sortColumn']] = (typeof sortColumn == 'undefined' ? '' : this.schema.fields[sortColumn]);
        params[map['sortDir']] = sortDir || '';
        return params;
}

No Responses to "yui-ext: Field names instead of column id’s"

Comment Form

Recommended Reading

No Google Reader feed was found with the provided ID. Please validate the ID in plug-in configuration.

Twitter

Posting tweet...

Powered by Twitter Tools

About

I'm a passionate Software Developer who loves juggling around with new technologies. This website is about my technical daily grind, problems i stumbled over and some private stuff.