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

Problem with the RowStyleSelector

Hello,

I have a problem with the RowStyleSelector.

I want to apply a particular style according to particular values in my SfDataGrid while maintaining an alternate row style.

When I use a SfDataGrid with DetailsViewDefinition option, in my CustomRowStyleSelector, the row indexes are 1,3,5,7 instead of 1,2,3,4,5.

I can’t use AlternatingRowStyle because this one overrides RowStyleSelector.

Currently, I’ve fixed the problem by using this formula: if ((row.RowIndex + 1) % 4 != 0).

I think it’s not a reliable solution. Do you have another/better solution?

Best regards,

Aurélien


Attachment: App9_d4a6b62f.zip

5 Replies

JS Jayapradha S Syncfusion Team April 15, 2016 12:31 PM UTC

Hi Aurélien,

Thank you for contacting Syncfusion Support.


We have analyzed your query. The row index  is varied when using DetailsViewDefinition, as each row has DetailsViewDataRow hidden under it. So, you can overcome this problem by using AlternateRowStyleSelector along with RowStyleSelector. In the AlternateRowStyleSelector, you can provide first priority for custom style and second priority for alternate style.

We have modified your sample and please find the sample from the following location,
Sample Link:  http://www.syncfusion.com/downloads/support/forum/123716/ze/App91457681435

Regards,
Jayapradha



AU Aurélien April 19, 2016 07:12 AM UTC

Hi Jayapradha,
I'll test it.
Thank you.



AP Ashwini Paranthaman Syncfusion Team April 20, 2016 10:42 AM UTC

Hi Aurelien,
 
Thank you for the update.
 
We will wait to hear from you.
 
Regards,
 
Ashwini P.


AU Aurélien April 21, 2016 06:47 AM UTC

Hi,
That works well !
Thank you.
Aurélien


SV Srinivasan Vasu Syncfusion Team April 22, 2016 11:28 AM UTC

Hi Aurelien, 
  
Thank you for the update.  
 
Please let us know if you need further assistance. 
  
Regards, 
Srinivasan 


Loader.
Up arrow icon