The properties of combo columns are as follows.

  • Default Properties : name, text, type, editable, visible, align, width
  • Adding property : renderer.

renderer property.

  • A combo column consists of valueName , textName, and data.
  • valueName property : Value field name in json data.
  • textName proptery : Label field name in json data.
  • data proptery : Json array.
  • You can also set a breakpoint on the page to check the data in this page.
  • This is a sample for data.
    // Examples
    let grid_data = [
        { "combo1": "01", "combo2": "1", "combo3": "1" },
        { "combo1": "02", "combo2": "2", "combo3": "2" },
    ];
    let comboData1 = [
        {code: '01', codeValue: '001' },
        {code: '02', codeValue: '002' },
    ];
    let comboData2 = [
        {key: '1', value: 'Baseball' },
        {key: '2', value: 'Basketball' },
    ];
    let comboData3 = [
        {Language: '1', LanguageValue: 'USA' },
        {Language: '2', LanguageValue: 'KOR' },
    ];
    
  • This is a sample for combo columns.
    // Examples
    let grid1;
    grid1 = new TbsGrid('grid1');
    
    let columns = [
          { name : 'combo1', header: { text:'code'     }, type : 'combo', renderer : { valueName : 'code'    , textName : 'codeValue'    , data : comboData1 }}
        , { name : 'combo2', header: { text:'Sports'   }, type : 'combo', renderer : { valueName : 'key'     , textName : 'value'        , data : comboData2 }}
        , { name : 'combo3', header: { text:'Language' }, type : 'combo', renderer : { valueName : 'Language', textName : 'LanguageValue', data : comboData3 }}
    ];
    
    let options = {};
    grid1.setGrid(columns, options);
    grid1.setData(grid_data);