Grid panel marking records

  1. #1

    Grid panel marking records

    Could I please get an example on how to mark records in a Grid panel for Ext.NET v7.2?

    I can not seem to workout how to update the v5.3 example.


    Thank you.
  2. #2
    Hello @harvca, and welcome to Ext.NET Forums!

    Can you point the exact v5.3 example you're talking about? All you'd need is to see how to make that example in v7?

    Looking forward to your follow-up!
    Fabrício Murta
    Developer & Support Expert
  3. #3
    Hi @fabricio.murta

    Here is the v5.3 example https://examples5.ext.net/#/GridPane...rking_Records/
    Yes all I need is how to do this in v7.

    To give some more context I am currently porting a .NET 4.6 (Ext.NET v2.5) app to .NET 5 (Ext.NET v7.2).
  4. #4
    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!
    Fabrício Murta
    Developer & Support Expert

Similar Threads

  1. grid panel does not clear the records
    By danillofratta in forum 2.x Help
    Replies: 2
    Last Post: Sep 26, 2013, 3:32 PM
  2. Sorting within Grid panel grouped records
    By ssenthil21 in forum 1.x Help
    Replies: 1
    Last Post: Jul 04, 2011, 7:42 AM
  3. Marking all records as dirty in a grid
    By n_s_adhikari@rediffmail.com in forum 1.x Help
    Replies: 1
    Last Post: May 10, 2010, 11:35 PM
  4. [CLOSED] marking all elements of a grid as new on server side
    By pschojer in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Aug 26, 2009, 7:48 AM
  5. Find Marking records in a grid
    By Kamal in forum 1.x Help
    Replies: 0
    Last Post: Jul 09, 2009, 8:43 AM

Posting Permissions