ParamQuery grid support forum

General Category => Help for ParamQuery Grid (free version) => Topic started by: sergeda on April 15, 2014, 02:58:30 pm

Title: Help with raw select
Post by: sergeda on April 15, 2014, 02:58:30 pm
Hi. Can somebody help me with this.
I'm trying to get data from the selected raw like in demo. But it doesn't work. Alert doesn't fire at all.
Code: [Select]
        $(window).on('load', function () {
            var data = [ [1,'Exxon Mobil','339,938.0','36,130.0'],
                [2,'Wal-Mart Stores','315,654.0','11,231.0'],
                [3,'Royal Dutch Shell','306,731.0','25,311.0'],
                [4,'BP','267,600.0','22,341.0'],
                [5,'General Motors','192,604.0','-10,567.0'],
                [6,'Chevron','189,481.0','14,099.0']];

            var obj = {};
            obj.colModel = [{title:"Rank", width:100, dataType:"integer"},
                {title:"Company", width:200, dataType:"string"},
                {title:"Revenues ($ millions)", width:150, dataType:"float", align:"right"},
                {title:"Profits ($ millions)", width:150, dataType:"float", align:"right"}];
            obj.dataModel = {data:data};
            $("#grid").pqGrid( obj );
            obj.rowSelect = function (evt, obj) {
                alert('Selected');
}


});
Title: Re: Help with raw select
Post by: paramvir on April 15, 2014, 06:43:58 pm
Grid constructor i.e. $("#grid").pqGrid( obj ) deep clones the obj so that grid can't use any property attached to obj after initialization.

Right way is to initialize the grid after attaching rowSelect callback to obj.