FlexGrid row and column cssClass issues

Posted by: elogsdon on 9 September 2020, 1:49 am EST

  • Posted 9 September 2020, 1:49 am EST

    I am having two issues in setting formatting on a specific column or row using cssClass on a FlexGrid.

    A screen shot of the grid is attached.

    First the column. If the column is read only, I have set the cssClass on a column to a css class that sets the backgroud color to orange. Only every other row is showing with the new color. I have specified AlternatingRowStep(0) on the FlexGrid definition.

    Second, the row. I am setting the background color to magenta based on a button click. Visually I can see the row flash briefly as magenta before resuming the default color. This is done in a javascript invoked by the button.

    The FlexGrid definition:

    .Bind(ib => ib.Update(Url.Action("GridUpdate")).OnClientQueryComplete("Complete")
    .Columns(c =>
    foreach (var col in Model.ColumnList)

    The custom css:
    .custom .lb-read-only {
    background-color: orange;

    .custom .lb-deleted {
    background-color: magenta;

    The Javascript to set the row css from the buton click:
    [code] function billDelete() {
    var batchEditGrid = wijmo.Control.getControl('#policyGrid');
    var cv = batchEditGrid.collectionView;

    batchEditGrid.rows[batchEditGrid.selection.row].cssClass = "lb-deleted";

    if (cv.currentEditItem.PolicyStatus == "D") {
    cv.currentEditItem.PolicyStatus = "A";
    else if (cv.currentEditItem.PolicyStatus == "N") {
    else {
    cv.currentEditItem.PolicyStatus = "D";

    Any further samples or clarification would be appreciated.

  • Replied 9 September 2020, 10:57 pm EST

    Hello Eric,
    We are sorry we are unable to replicate the issue. Please refer to the attached sample for reference.

    Manish Gupta

  • Replied 11 September 2020, 1:43 am EST

    I upgraded from 2020.v1 to 2020.v2 and that resolved the column format issue.

    It seems that the issue with the row format is related to the GridUpdate routine specified in the FlexGrid definition. This returns the model containing the data to be bound.

    I am thinking that instead of setting the cssClass in the button onClick routine I need to look at the data when it is loaded and set the cssClass at that point. Should I use OnLoadedRows event handler to scan the rows or would there be a better place to do this? An example of using the event handler would help.

  • Marked as Answer

    Replied 13 September 2020, 8:43 pm EST

    Hello Eric,
    Yes, the OnClientLoadedRows event would be fine in case it's only when the data is loaded in FlexGrid.
    If you are changing the row color as the Update request is completed, then the OnClientQueryComplete event is recommended.

    Manish Gupta
  • Replied 14 September 2020, 7:48 am EST

    Is there documentation on the arguments to ClientQueryComplete? I assume it is Sender and Event Args, but I don't now the contents of them.
  • Replied 14 September 2020, 4:09 pm EST

    Hello Eric,
    Yes, you are correct. OnClientQueryComplete event accepts two parameters sender and eventargs.
    First parameter is sender which is CollectionView and second parameter is QueryCompleteEventArgs. Please refer to the following code snippet for reference:

    Manish Gupta
  • Replied 15 September 2020, 7:32 am EST

    That works well. Thanks!
Need extra support?

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

Learn More

Forum Channels