Blank cell value when ID is not present in dataMapBindKey's dropdown array

Posted by: mothydharan on 15 March 2018, 11:59 pm EST

    • Post Options:
    • Link

    Posted 15 March 2018, 11:59 pm EST

    Hi,

    My application uses wijmos flexgrid and it has been written in react-redux.

    Scenario: The grid has two columns- Name(text) and Country(dropdown). Suppose the grid data(itemSource) has a CountryID which is not present in the country array list(dropdown) ,ie the CountryID is not matching with the dataMapBindKey’s of dropdown array list.

    For such scenarios,we need to display the cell value as blank within the grid.

    Can you please help me to achieve this?

  • Posted 18 March 2018, 4:59 pm EST

    Hi Mothy,

    You may show blank cell using itemFormatter. You need to find if targeted cell do not have mapped value, set cell HTML as per need.

    For your reference, please refer to the attached sample.

    ~Manish

    FlexGrid_dataMap.zip

  • Posted 22 March 2018, 5:11 pm EST

    Thank you Manish for your reply.

    I was mentioning about the below scenario.Please see the attached file.

    Scenario : In the sample you have shared, i have pushed a new item which is having ID as 70. But in the dropdown array list we have only data for ID’s from 1 to 10.

    Issue: Since we don’t have any value for the ID 70 within the array, grid dropwdown will be displaying the ID value 70 intead of text .

    Requirement: When the ID is not present in the array list we need to show empty or blank data.

    Kindly help me to achieve this.

    FlexGrid_DataMap.zip

  • Posted 26 March 2018, 10:08 pm EST

    Hi Manish,

    Kindly help me to resolve the above mentioned scenario.

    Thank you

  • Posted 27 March 2018, 7:24 pm EST

    Hi,

    You can easily achieve that with the help of itemFormatter.

    //refer to following code snippet

    
    flex1.itemFormatter=function(panel,r,c,cell){
    if(panel.cellType=wijmo.grid.CellType.Cell&&panel.columns[c].dataMap){
    var data=panel.getCellData(r,c,false);
    var key=panel.columns[c].dataMap.getKeyValue(data);
    if(!key){
    cell.childNodes[0].textContent="";
    }
    }
    }
    

    Here is the updated fiddle example for the same:-http://jsfiddle.net/exk74tkk/

  • Posted 1 April 2018, 6:10 pm EST

    Thank you @abhishek…It helped me

Need extra support?

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

Learn More

Forum Channels