Hello again, @harvca!
Thanks for the clarifications. Here you go:
-
t63178_markRecords.cshtml
@page
@model ExtNet7WebPages_NuGet.Pages.Forums._6._3._0_2.t63178_markRecordsModel
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<title>
63178 - Grid Panel > Miscellaneous > Marking Records
</title>
<style type="text/css">
.dirty-row .x-grid-cell, .dirty-row .x-grid-rowwrap-div {
background-color: #FFFDD8 !important;
}
.new-row .x-grid-cell, .new-row .x-grid-rowwrap-div {
background: #c8ffc8 !important;
}
</style>
<script type="text/javascript">
var getRowClass = function (record) {
if (record.phantom) {
return "new-row";
}
if (record.dirty) {
return "dirty-row";
}
};
var insertRecord = function () {
var grid = App.GridPanel1;
grid.store.insert(0, {});
grid.getView().focusRow(0);
grid.editingPlugin.startEdit(grid.store.getAt(0), grid.columns[0]);
};
</script>
</head>
<body>
<h1>
Grid Panel > Miscellaneous > Marking Records
</h1>
<p>Demonstrates how to mark rows with custom colors. Edit any cell or insert new record.</p>
<ext-gridPanel id="GridPanel1" title="Test Grid" width="600" height="350">
<store>
<ext-store data="Model.GridData">
<model>
<ext-model idProperty="TestCell">
<fields>
<ext-dataField name="TestCell" />
</fields>
</ext-model>
</model>
</ext-store>
</store>
<columns>
<ext-column text="TestCell" dataIndex="TestCell" flex="1" editor="textfield" />
</columns>
<viewConfig>
<ext-tableView x-xtype="gridview">
<customConfig>
<ext-add key="getRowClass" value="getRowClass" mode="Raw" />
</customConfig>
</ext-tableView>
</viewConfig>
<plugins>
<ext-cellEditingPlugin clicksToEdit="1">
<listeners>
<edit handler="editor.grid.getView().refresh();" />
</listeners>
</ext-cellEditingPlugin>
</plugins>
<buttons>
<ext-button text="Insert record" iconCls="x-md md-icon-add">
<listeners>
<click fn="insertRecord" />
</listeners>
</ext-button>
</buttons>
</ext-gridPanel>
</body>
</html>
-
t63178_markRecords.cshtml.cs
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace ExtNet7WebPages_NuGet.Pages.Forums._6._3._0_2
{
public class t63178_markRecordsModel : PageModel
{
public List<object> GridData
{
get
{
var data = new List<object>();
for (var i = 1; i <= 15; i++)
{
data.Add(new object[] { "Sample " + i });
}
return data;
}
}
public void OnGet()
{
}
}
}
Hope this helps!