Author Topic: Custom editing with dropdown in grid  (Read 7558 times)

lalitsingh

  • Newbie
  • *
  • Posts: 5
    • View Profile
Custom editing with dropdown in grid
« 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

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6265
    • View Profile
Re: Custom editing with dropdown in grid
« Reply #1 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);
}
« Last Edit: December 27, 2013, 06:38:07 pm by paramquery »

lalitsingh

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Custom editing with dropdown in grid
« Reply #2 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. ?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6265
    • View Profile
Re: Custom editing with dropdown in grid
« Reply #3 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.
« Last Edit: December 27, 2013, 08:35:03 pm by paramquery »