Need solution when datamap is an array of object instead of an array

Posted by: samvarth123 on 3 June 2019, 6:18 pm EST

  • Posted 3 June 2019, 6:18 pm EST

    Hi !

    In the link below :

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

    this.allCountries is array and I want to achieve the same functionality that once a country is selected it should not be repeated in the second row.Here I need this .allCountries to be an array of objects instead of a plain array so that my functionality will be achieved

    Any pointers will be helpful for me.

    Thanks,

    Siva

  • Posted 4 June 2019, 3:36 am EST

    Hi Siva,

    As part of the design dataMaps are applied on the column level and not the cell level. So it is not possible to achieve the required behaviour with dataMaps where display text and binding values are different.

    In this case, you could use ComboBox as the editor for the cell. Please refer to the following sample which demonstrates the use of Custom editors:

    https://www.grapecity.com/wijmo/demos/Grid/Editing/CustomEditors/angular

    Regards

  • Posted 4 June 2019, 5:52 am EST

    Hi !

    But the demo you gave has combo box but values seems to be repeating.Could you please give an example for the combo box to achieve the same.Value should not repeat in the other row once its selected in a previous row

    Thanks,

    Siva

  • Posted 6 June 2019, 6:58 am EST

    You can achieve the desired behavior using dataMap only. In the beginningEdit event, instead of getting a whole new array, you could just filter out the items from the datamap, that are already added to the rows. Please refer to the sample below:

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

Need extra support?

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

Learn More

Forum Channels