EasyUI Forum
April 16, 2024, 03:57:15 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: [SOLVED] DataGrid Combo Editor  (Read 3964 times)
Pierre
Sr. Member
****
Posts: 439


View Profile Email
« on: February 15, 2017, 02:30:13 PM »

Hello
I need to use Combobox as Editor (in datagrid) for some products and for some not.
With other words, for some products I need "Red", "Blue", "Orange" color and for some products it must be only "No color" option.
How to do that, please?
Thank you.
« Last Edit: February 16, 2017, 12:04:31 PM by Pierre » Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: February 16, 2017, 01:11:33 AM »

You can change the edition options before editing a row.
Code:
$('#dg').datagrid({
  onBeforeEdit:function(index,row){
    var col = $(this).datagrid('getColumnOption','productid');
    col.editor = {
      type:'combobox',
      options:{
        data:[{
          value:'Red',
          text:'Red'
        },{
          value:'Blue',
          text:'Blue'
        }]
      }
    }
  }
})
Logged
Pierre
Sr. Member
****
Posts: 439


View Profile Email
« Reply #2 on: February 16, 2017, 12:04:19 PM »

Awesome, thank you so much.  Grin
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!