Grid CSS - highlight row selected
|
<style>
.e-grid .e-rowcell.e-selectionbackground{
background-color: aqua !important;
}
...
</style>
|
|
|
- Reproduce the problem in the provided sample and revert back to us.
- Share a simple sample which you are tried at your end.
- Share the CSS codes.
Hi Syncfusion Team,
Thanks for this solution. However, is there a way to apply the background color to the edited row?
Gerald
Hi Gerald ,
Sorry for the Inconvenience.
We are currently Validating the reported query at our end and we will update the further details within one day(Aug 24, 2022). Until then we appreciate your patience.
Regards,
Naveen Palanivel
Hi Gerald,
We checked your query and achieve your requirement after row is edited , we give color to the edited row using OnActionBegin and RowDataBound event. We prepared sample and attached in this ticket, kindly refer the snippet code and attached sample for your reference
|
public void ActionBeginHandler(ActionEventArgs<Order> args) { if (args.RequestType == Syncfusion.Blazor.Grids.Action.Save) { EditedRecordValue.Add(args.Data.OrderID); }
} public void RowDataBoundHandler(RowDataBoundEventArgs<Order> args) { for(int i = 0; i <EditedRecordValue.Count; i++) { if (EditedRecordValue[i].Value == args.Data.OrderID) { args.Row.AddClass(new string[] { "EditAfter" }); }
}
} |
Please get back to us if you need further assistance.
Regards,
Naveen Palanivel
Attachment: BlazorAppgrid_96791bfa.zip
Hi Naveen,
Sorry - I think I need to clarify.
I only want the row currently being edited to have a background colour. So:
- No row selected - default background colour
- Row selected and put into edit mode, OR row added and still in edit mode - change the background colour to aqua
- Row saved, or edit cancelled - change the background colour back to default background colour.
Hi Gerald
Thanks for the Update
We checked your query when the row is in editing state to change background color of the row . we achieved your requirement by given background color to the class( .e-grid .e-row.e-editedrow .e-gridform tr). Please refer the snippet code and attached sample for your reference.
|
<style>
.e-grid .e-row.e-editedrow .e-gridform tr {
background-color:aqua; }
</style> |
Please get back to us if you need further assistance.
Regards,
Naveen Palanivel
Attachment: BackGroundColor_32b0dedb.zip
Hi Naveen,
That worked great! Thank you!
Gerald.
Hi Naveen,
Sorry - one more question. For an added row under edit, how would we apply the same color? Your code above works for existing rows that are being edited, but not for a new row being edited. Thanks!
Gerald
Hi Gerald,
Thanks for the Update
We checked your query when the row is in editing state and new row is added in editing state to change background color of the row . we achieved your requirement by given background color to the class( .e-grid .e-row.e-editedrow .e-gridform tr && .e-grid .e-row.e-addedrow .e-gridform tr ). Please refer the snippet code and attached sample for your reference.
|
<style>
.e-grid .e-row.e-editedrow .e-gridform tr {
background-color:aqua; } .e-grid .e-row.e-addedrow .e-gridform tr {
background-color:aqua; }
</style> |
Please get back to us if you need further assistance.
Regards,
Naveen Palanivel
Hi Naveen,
That works well. Thank for your help. Much appreciated.
Gerald
Sorry - one more question -
For the CSS code - is there a way to apply to all pages that consume the Syncfusion Grid? Currently this is added to each razor page with a data grid:
<style type="text/css" class="cssStyles">
.warning {
background-color: yellow;
}
.error {
background-color: red;
}
.e-grid .e-rowcell.e-selectionbackground {
background-color: aqua !important;
}
.e-grid .e-row.e-editedrow .e-gridform tr {
background-color:aqua !important;
}
.e-grid .e-row.e-addedrow .e-gridform tr {
background-color: aqua !important;
}
</style>
I tried adding the css elements to site css, but it still takes the default syncfusion colour scheme.
T
Hi Gerald,
Welcome from Syncfusion support.
We have analyzed your query and we suggest you add the CSS style code in the site.css file to apply to all pages that consume the Syncfusion Grid. We have
attached the screenshot of the code and output based on your requirement. Kindly
refer to the attached screenshot for your reference.
Kindly get back to us if you have any further queries.
Regards,
Keerthana.
Attachment: Site_6317a341.zip
Thanks again for your help.
One (hopefully last) question - if the grid is in batch mode (not in-line mode, which the above works well), how do I colour the row being edited? Thanks again!
G
Hi Gerald,
We
checked your query when the row is in batch mode editing state to change background color of the edited cell . we achieved your requirement by given background color to the class (.e-grid .e-editedbatchcell.e-rowcell .e-gridform).
Please refer the snippet code for your reference.
|
.e-grid .e-editedbatchcell.e-rowcell .e-gridform{ background-color:aqua; } |
Please get back to us if you need further assistance.
Regards,
Naveen Palanivel
Hi Naveen,
Thank you - is it possible to do change color of the whole row that the edited cell is located?
G
Hi Gerald,
We checked your query and we like to inform that when we try to edit In batch edit mode. when you double-click on the datagrid , the target cell changes to edit state in batch mode. So it only possible to color to the target cell in Batch mode edit.
Kindly get back to us if you have any further queries.
Regards,
Naveen Palanivel
Thanks Naveen for your help.
Gerald
Hi Gerald,
Welcome
Please get back to us if you need further assistance.
Regards,
Naveen Palanivel.
- 22 Replies
- 6 Participants
- Marked answer
-
AR Andy Richard
- Mar 23, 2021 09:27 PM UTC
- Sep 8, 2022 07:25 PM UTC