Author Topic: How to I set combo box in grid cell?  (Read 3022 times)

SHIN WOOCHUL

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 13
    • View Profile
How to I set combo box in grid cell?
« on: November 25, 2019, 04:27:54 pm »
I used cell select combo box, but I don't know how to use it,
I want  column set like this
{ title: "회사 코드", width: "120", dataIndx: "Country",
                cls: 'beige',               
                editor: {
                    type: 'select',   
                    options: function(ui){
                       
                       var itemCd = ui.rowData.itemCd;
                       alert(itemCd);
                       var formData = new FormData(document.getElementById('selectItem'));
                       $('#kitemCd').val(itemCd);
                       $.ajax({
                         type : "POST",
                          contentType: false,
                            processData: false,
                         url : "/OrderMng/odr05/selectContractList.do",
                         cache : false,
                         data : formData,
                         success : function(json,status){
                            var $cell = ui.$cell;
                              var dataIndx = ui.dataIndx;
                              var cls = ui.cls;
                            var compList = json.resultList;
                        var innerHtml = '<select id="example" name="'+dataIndx+'" multiple="multiple" class="'+cls+'">';
                             for(var i = 0;i<compList.length;i++){                                
                                innerHtml += '<option value="'+compList.compCd+'">'+compList.compNm+'</option>';
                             }
                             innerHtml += '</select>';   
                             $cell.html(innerHtml);
                         
                         }
                       });
                    }
                }
            },
but it can make select box but it dose not work select data, It that good idea how to make select box?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: How to I set combo box in grid cell?
« Reply #1 on: November 25, 2019, 10:41:23 pm »
you can't create combo box or select list in a grid cell but you can create it as an editor.

Example: ShipCountry, Books, Ship Via columns in this demo: https://paramquery.com/pro/demos/editing_custom

SHIN WOOCHUL

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: How to I set combo box in grid cell?
« Reply #2 on: November 26, 2019, 08:03:47 am »
I apply this code but it happen error that it does not have label,
so I wonder how to set data arrayList into this select box editor
also Is It possible to setting like  <opiton value = 'value'>name</option> like this structure?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: How to I set combo box in grid cell?
« Reply #3 on: November 26, 2019, 09:50:14 pm »
Quote
I apply this code but it happen error that it does not have label,
Please share a jsfiddle.

Quote
so I wonder how to set data arrayList into this select box editor

select box editor options can be any one of the mentioned format:

https://paramquery.com/pro/api#option-column-editor

Quote
also Is It possible to setting like  <opiton value = 'value'>name</option> like this structure?

No, please don't use this format.