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:
@(Html.C1().FlexGrid().Id("policyGrid")
.CssClass("custom")
.IsReadOnly(true)
.SortingType(C1.Web.Mvc.Grid.AllowSorting.SingleColumn)
.Bind(ib => ib.Update(Url.Action("GridUpdate")).OnClientQueryComplete("Complete")
.Create(Url.Action("GridCreate"))
.Delete(Url.Action("GridDelete"))
.DisableServerRead(true)
.Bind(Model.Policies))
.AutoGenerateColumns(false)
.AlternatingRowStep(0)
.IsReadOnly(false)
.ShowColumnFooters()
.Columns(c =>
{
foreach (var col in Model.ColumnList)
{
c.Add(col);
}
})
.AllowAddNew(true)
.AllowDelete(true)
.ShowErrors(true)
.OnClientLoadedRows("fixDefaultJSAlert")
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:
function billDelete() {
var batchEditGrid = wijmo.Control.getControl('#policyGrid');
var cv = batchEditGrid.collectionView;
cv.editItem(batchEditGrid.rows[batchEditGrid.selection.row].dataItem);
batchEditGrid.rows[batchEditGrid.selection.row].cssClass = "lb-deleted";
if (cv.currentEditItem.PolicyStatus == "D") {
cv.currentEditItem.PolicyStatus = "A";
}
else if (cv.currentEditItem.PolicyStatus == "N") {
cv.removeAt(batchEditGrid.selection.row);
}
else {
cv.currentEditItem.PolicyStatus = "D";
}
cv.commitEdit();
}[\code]
Any further samples or clarification would be appreciated.
Eric
[img]https://gccontent.blob.core.windows.net/forum-uploads/file-dba7c78b-e9a8-4ede-8b87-0193fb88f338.png[/img]