ParamQuery grid support forum

General Category => Help for ParamQuery Pro => Topic started by: russellr on March 10, 2017, 10:35:14 pm

Title: Issues with mapIndices
Post by: russellr on March 10, 2017, 10:35:14 pm
One problem I notice when using the mapIndices is that even though I am only interested in one value I must define both indies or throws an error.    Example follows.

                   colModel : [
                        { dataType:"string",  dataIndx:"null", editable: false,  hidden:true },
                        { title: "Business Unit", width: "25%", dataIndx: "business_unit_id", editable: true,
                            editor: {
                                type: "select",
                                labelIndx : "name",
                                valueIndx : "id",
                                mapIndices: { "id":"business_unit_id",  "name":"null" },      <--------
                                prepend : {"0":"All Business Units"},
                                options: function (ui){
                                    var filteredList = [];
                                    var colValue = parseInt( ui.rowData['group_id'] );
                                    dataBusinessList.forEach( function(item, index, array) {
                                        if( item.group_id == colValue ) filteredList.push(item);
                                    });
                                    return filteredList;
                                }
                            },
                            render: function(ui) {
                                var v = parseInt( ui.rowData['business_unit_id'] );
                                if( v == 0 ) return "All Business Units";

                                var i = jsonQ.index( dataBusinessList, { "id" : v }, true );
                                if( i >= 0 )
                                    return dataBusinessList.name;
                                else
                                    return "Invalid Business Unit Id";
                            }
                        },

This example is part of a cascading set of drop-down list and it works.   However I must specify a (throw away) column to put the unwanted "name" value in or the code will generate an error.   If I just use " mapIndices: { "id":"business_unit_id"} " it will throw an exception.   I wish it would only process the indices defined within the parameter.

I have traced the issue to line 5616 in pqgrid.dev.js  "newRow" contains both indices even though I only specified one in mapIndices.    It would be nice, if you specified mapIndices it would only processes the ones you specify.