customize cell does not work


My Code:

<ejs-grid id="grid" dataSource="ViewBag.dataSource"   queryCellInfo="customiseCell" ..

 <e-grid-column field="UmsatzVj" headerText="UmsatzVj" format="N0" textAlign="Right" width="150"></e-grid-column>

<script>
                        function customiseCell(args) {
                            if(args.column.field > 'UmsatzVj') {
                                if (args.data['UmsatzVj'] < 0) {
                                    args.cell.classList.add('below-0');
                                    } else {
                                        args.cell.classList.add('above-0');
                                    }
                                }
                            }
</script>

 <style>
                below-0{
                    color:red;
                }
                above-0 {
                    color: black;
                }
            
</style>

What's wrong???

1 Reply

PS Pavithra Subramaniyam Syncfusion Team March 4, 2019 05:50 AM UTC

Hi Reinhard, 
 
Greetings from Syncfusion. 
 
We have checked your query and we suspect that the cause of the reported behavior might be the condition(“if(args.column.field > 'UmsatzVj')” ) you are using inside the ‘queryCellInfo’ event. Could you please ensure whether any reason for this condition (comparing two strings). If no, We suggest you to change the operator “>” to “==” to achieve your requirement. 
 
 
If you are still facing the issue could you please provide the below details that will be helpful for us to provide a better solution as early as possible. 
 
  1. Sharer your full Grid code.
  2. Ensure whether the custom CSS classes (“below-0” Or “above-0”) are added to the Cell element.
  3. Share your Syncfusion package version.
 
Regards, 
Pavithra S. 


Loader.
Up arrow icon