Drop-down on particular cell

Posted by: unnati.kbalas on 24 December 2019, 9:24 am EST

    • Post Options:
    • Link

    Posted 24 December 2019, 9:24 am EST

    I tried 2 way to do this. first one is ```

    grid.formatItem.addHandler((s, e: wjcGrid.FormatItemEventArgs) => {

    if (e.panel.rows[e.row]._data[alt].controlType === ‘DropDown’){

    const theComboBox = new input.ComboBox(e.cell, {

    itemsSource: items

    });

    }});

    but it loosing a control while grid update and second one is 
    

    grid.formatItem.addHandler((s, e: wjcGrid.FormatItemEventArgs) => {

    if (e.panel.rows[e.row]._data[alt].controlType === ‘DropDown’){

    const col = s.columns[e.col];

    col.dataMap = [‘Washington’, ‘Miami’];

    }});

    this generates continues update on grid and it's for column. can anyone suggest me how could I put dropdown on single cell, not on entire column.
  • Posted 26 December 2019, 2:19 am EST

    Hi Unnati,

    You can set the DataMap for the entire column and remove the drop-down from those cells which do not require the data map. Please refer to the sample below:

    https://stackblitz.com/edit/angular-j2uamq

    This procedure will still use DataMap internally for non data map cells.

    You can also add the ComboBox directly to the cells using the formatItem event. Please refer to the sample link for a demo:

    https://stackblitz.com/edit/angular-cx9vfk

    Regards,

    Ashwin

  • Posted 26 December 2019, 7:55 am EST

    Your solution is good but when I changed the dropdown value, Gridchanged or cellEditEnding event not called.

  • Posted 27 December 2019, 12:06 am EST

    Hi Unnati,

    If you will use the DataMap’s solution, the cellEditEnding and cellEditEnded event will fire as expected. You may verify the same using the updated sample below:

    https://stackblitz.com/edit/angular-s5njb3

    But while using the ComboBox as editors, you will need to raise these events manually. Please refer to the sample below for reference:

    https://stackblitz.com/edit/angular-6bs5dq

    Regarding gridChanged event:

    The gridChanged is an event for Row and Column class and only fires when the grid property of the row or column changes. Could you please explain your use case for this?

    ~regards

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels