ParamQuery grid support forum

General Category => Help for ParamQuery Grid (free version) => Topic started by: lalitsingh on December 27, 2013, 01:03:06 pm

Title: Custom editing with dropdown in grid
Post by: lalitsingh on December 27, 2013, 01:03:06 pm
Hi ,

I am using custom editing  grid section from the demos, i am using dropDownEditor, i found that there is one function

 var dropDownEditor = function (ui, arr) {
                    debugger;
                    var $cell = ui.$cell, data = ui.data, rowIndx = ui.rowIndxPage, colIndx = ui.colIndx;
                    var dataCell = $.trim(data[rowIndx][colIndx]);
                    var str = "";
                    for (var i = 0; i < arr.length; i++) {
                        if (dataCell == arr)
                            str += "<option selected>" + arr + "</option>";
                        else str += "<option>" + arr + "</option>";
                    }
                    var $sel = $("<select>" + str + "</select>")
                        .appendTo($cell);
                }

from where does "ui" parameter be passed , i am seeing it shows undefined.

i have kept in body of my html page as   <div id="grid_custom_editing" style="width: 100%;"></div>.

please let me know what ui will contain.

Regards,

Lalit Singh
Title: Re: Custom editing with dropdown in grid
Post by: paramvir on December 27, 2013, 06:36:25 pm
In the demo

http://paramquery.com/demos/editing_custom

ui is received by editor callback as argument and  passed onto dropDownEditor.

http://paramquery.com/api#option-column-editor

Code: [Select]
editor: function (ui) {
     var arr = ['', 'Speedy Express', 'United Package', 'Federal Shipping'];
     dropDownEditor(ui, arr);
}
Title: Re: Custom editing with dropdown in grid
Post by: lalitsingh on December 27, 2013, 07:44:12 pm
i tried above code as also mentioned in demos. but it is not working.

do i have to already keep table with dropdown created or it will generate dropdown dynamically. ?
Title: Re: Custom editing with dropdown in grid
Post by: paramvir on December 27, 2013, 08:25:55 pm
It creates dropdown dynamically.

Please post your code in http://jsfiddle.net/LAgZx/64/ to check which part of your code is not working.