We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Condition format and cell selection


Hi all,

I have implemented something like condition format on a grid using the queryCellInfo with the possibility to select multiple cells at same time. 

At this moment I'm having trouble when select the "painted" cells. The cells are selected but I can't see the selection color.

I already try check some arguments on queryCellInfo but this event don't fire when i select cells.

How I can workaround this?

Many thanks in advance.

Regards,  

3 Replies

RU Ragavee U S Syncfusion Team July 21, 2015 09:36 AM UTC

Hi Carlos,

Thanks for your interest in Syncfusion products.

We have analyzed your requirement and thus prepared a solution to achieve your requirement. Please refer the below code snippet.

<style>

        .selectClass {

            background-color: #1f7499 !important;/*default selection color of the grid in flat-azure theme*/

            color: white !important;

        }

    </style>


<script type="text/javascript">

       

        $(function () {

            $("#Grid").ejGrid({

                // the datasource "window.gridData" is referred from jsondata.min.js

                . . .

               selectionSettings: { selectionMode: ["cell"], enableToggle: true },

                selectionType: "multiple",

                . . . .

               //for removing the class when enable toggle is set as true

                recordClick: function(e){

                    if (e.model.selectionSettings.enableToggle && !$(e.cell).hasClass("e-cellselectionbackground"))

                        $(e.cell).removeClass("selectClass");

                },

                //adding the class to the cell on selection

                cellSelected: function (args) {

                    if ($(args.currentCell).hasClass("e-cellselectionbackground"))

                        $(args.currentCell).addClass("selectClass");                   

                }

            });          

        });      


    </script>


In the above snippet, we have applied the default selection color to the selected cell thus overriding the “painted” cell color in the cellSelected event of the grid.

For your convenience, we have created a sample with the above solution and the sample can be downloaded from the below location.

Sample Link: http://www.syncfusion.com/downloads/support/forum/119666/ze/Sample1544948539

Please get back to us if you need any further assistance.

Regards
Ragavee U S


CS Carlos Sereno July 23, 2015 02:37 PM UTC

Hi Ragavee,

Thanks for the snippet. 

I try it but don't work well as i want. This example only work if i have the toggle option for selection. What i want is show the selected cell or multiple cells when use the ctrl key for select and deselect all other cells when i select an individual cell. 

However i get an solution using the next snippet.

<style>

        .e-cellselectionbackground {

            background-color: #1f7499 !important; /*default selection color of the grid in flat-azure theme*/

            color: white !important;

        }

</style>


Sorry if i don't explain well on first time.  


Many thanks, Regards

CS




AS Alan Sangeeth S Syncfusion Team July 27, 2015 01:08 PM UTC

Hi Carlos,

Thanks for the update.

We are happy to hear that your requirement has been achieved.

Please let us know if you need any further assistance. We will be happy to help you out.

Regards,
Alan Sangeeth S

Loader.
Up arrow icon