[CLOSED] GridPanel - "select all" feature?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    [CLOSED] GridPanel - "select all" feature?

    Hi, Ext.NET

    Our users need to be able to manually select all the data from a GridPanel. And then paste the results somewhere else.

    Below is an example of a GridPanel ... the problem is that we can't ever get the "header row" to be selected.
    This is basically the column object's "text" property, which is the user friendly verbiage for the column's "dataindex".

    Is there a plugin or some configuration or JS logic that can achieve this? Thanks

    <%@ Page Language="C#" %>
    <%@ Import Namespace="System.Data" %>
    <script runat="server">    
    
        protected void Page_Load(object sender, EventArgs e){
            if (!Page.IsPostBack && !X.IsAjaxRequest)
            {
                var gridCM = FPHGridPanel.ColumnModel;
                    gridCM.Add(new Column() { DataIndex = "LOCATION", Text = "LOCATION", Sortable = true, CellWrap = true, Align = ColumnAlign.Center });
                    var gridSummary = new Renderer() { Fn = "custSumRender" };
                    gridCM.Add(new Column() { DataIndex = "Healthy", Text = "Healthy", Sortable = true, SummaryType = SummaryType.Sum, SummaryRenderer = gridSummary, CellWrap = true, Align = ColumnAlign.Center });
                    gridCM.Add(new Column() { DataIndex = "Expiring (>3 but <= 6 months remaining)", Text = "Expiring (>3 but <= 6 months remaining)", Sortable = true, SummaryType = SummaryType.Sum, SummaryRenderer = gridSummary, CellWrap = true, Align = ColumnAlign.Center });
                    gridCM.Add(new Column() { DataIndex = "Expiring within 3 months", Text = "Expiring within 3 months", Sortable = true, SummaryType = SummaryType.Sum, SummaryRenderer = gridSummary, CellWrap = true, Align = ColumnAlign.Center });
                    gridCM.Add(new Column() { DataIndex = "Inactive Rep Qty", Text = "Inactive Rep Qty", Sortable = true, SummaryType = SummaryType.Sum, SummaryRenderer = gridSummary, CellWrap = true, Align = ColumnAlign.Center });
                    gridCM.Add(new Column() { DataIndex = "Completed", Text = "Completed", Sortable = true, SummaryType = SummaryType.Sum, SummaryRenderer = gridSummary, CellWrap = true, Align = ColumnAlign.Center });
                    gridCM.Add(new Column() { DataIndex = "Not Completed", Text = "Not Completed", Sortable = true, SummaryType = SummaryType.Sum, SummaryRenderer = gridSummary, CellWrap = true, Align = ColumnAlign.Center });
                    gridCM.Add(new Column() { DataIndex = "Ahead of Projected Burn Rate", Text = "Ahead of Projected Burn Rate", Sortable = true, SummaryType = SummaryType.Sum, SummaryRenderer = gridSummary, CellWrap = true, Align = ColumnAlign.Center });
                    gridCM.Add(new Column() { DataIndex = "StatusTotal", Text = "", Sortable = true, SummaryType = SummaryType.Sum, SummaryRenderer = new Renderer() { Fn = "custGrandTotal" }, CellWrap = true, Align = ColumnAlign.Center, Renderer = new Renderer() { Fn= "sumColumnRender" } });
    
                var FPHStore2 = new Store();
                var FPHDataModel2 = new Model();
                FPHDataModel2.Fields.Add(new ModelField() { Name = "LOCATION", Type = ModelFieldType.String, });
                FPHDataModel2.Fields.Add(new ModelField() { Name = "Healthy", Type = ModelFieldType.Int, });
                FPHDataModel2.Fields.Add(new ModelField() { Name = "Expiring (>3 but <= 6 months remaining)", Type = ModelFieldType.Int, });
                FPHDataModel2.Fields.Add(new ModelField() { Name = "Expiring within 3 months", Type = ModelFieldType.Int, });
                FPHDataModel2.Fields.Add(new ModelField() { Name = "Inactive Rep Qty", Type = ModelFieldType.Int, });
                FPHDataModel2.Fields.Add(new ModelField() { Name = "Completed", Type = ModelFieldType.Int, });
                FPHDataModel2.Fields.Add(new ModelField() { Name = "Not Completed", Type = ModelFieldType.Int, });
                FPHDataModel2.Fields.Add(new ModelField() { Name = "Ahead of Projected Burn Rate", Type = ModelFieldType.Int, });
                FPHDataModel2.Fields.Add(new ModelField() { Name = "StatusTotal", Type = ModelFieldType.Int });
    
    
                FPHStore2.Model.Add(FPHDataModel2);            
    
                var table = new DataTable();                        
    
                table.Columns.Add("LOCATION", typeof(string));
                table.Columns.Add("Healthy", typeof(int));
                table.Columns.Add("Expiring (>3 but <= 6 months remaining)", typeof(int));
                table.Columns.Add("Expiring within 3 months", typeof(int));
                table.Columns.Add("Inactive Rep Qty", typeof(int));
                table.Columns.Add("Completed", typeof(int));
                table.Columns.Add("Not Completed", typeof(int));
                table.Columns.Add("Ahead of Projected Burn Rate", typeof(int));            
    
                table.Rows.Add(new object[8] { "Samples in the Field at Risk", 100, 200, 300, 400, 500, 600, 700 });
                table.Rows.Add(new object[8] { "New Trained Rep", 200, 300, 300, 400, 500, 100, 200 });
                table.Rows.Add(new object[8] { "Zero Lctn", 0, 0, 0, 0, 0, 0, 0 });
                table.Rows.Add(new object[8] { "Zero Lctn2", 0, 0, 0, 0, 0, 0, 0 });
                table.Rows.Add(new object[8] { "Zero Lctn3", 0, 0, 0, 0, 0, 0, 0 });
                table.Rows.Add(new object[8] { "Zero Lctn4", 0, 0, 0, 0, 0, 0, 0 });
                table.Rows.Add(new object[8] { "Zero Lctn5", 0, 0, 0, 0, 0, 0, 0 });
                table.Rows.Add(new object[8] { "Zero Lctn6", 0, 0, 0, 0, 0, 0, 0 });
                table.Rows.Add(new object[8] { "Returning Product", 100, 200, 300, 400, 500, 600, 700 });
                table.Rows.Add(new object[8] { "Rep to Rep Transfers in Last 90 Days", 25, 200, 300, 77, 500, 489, 0 });
                table.Rows.Add(new object[8] { "Ahead of Projected Burn Rate", 25, 200, 300, 77, 500, 489, 0 });
                
                table.Columns.Add("StatusTotal", typeof(int));
                foreach (DataRow r in table.Rows)
                {
                    int statusTotal = 0;
    
                    for (int i= 0; i < table.Columns.Count; i++)
                    {
                        if (r[i].GetType() == typeof(int))
                        {
                            statusTotal += (int) r[i];
                        }
                    }                
                    r["StatusTotal"] = statusTotal;
                }
    
                FPHStore2.Data = table;
    
                FPHStore2.DataBind();
                //FPHStore2.FilterBy(new JFunction() { Fn = "custFilter" });
                FPHGridPanel.Store.Add(FPHStore2);
            }
            
        }
    </script>
    
    <!DOCTYPE html>
    
    <html>
    <head>
        <title>Select all from Grid Panel</title>    
    
        <script>
    
            var sumColumnRender = function (value, metadata, record, rowIndex, colIndex, store, gridView) {         
                return store.data.items[rowIndex].data["LOCATION"] + " Total:<br/>" + value;
            }
    
            var custSumRender = function (value, cols, colHeader, metadata) {
                return ('Total ' + colHeader + ':<br/>' + value);
            }
    
            var custGrandTotal = function (value, cols, colHeader, metadata) {
                return ('<b><i>Grand Total</i></b>:<br/>(<i>' + value + '</i>)');
            }
    
        </script>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />        
    
            <ext:GridPanel ID="FPHGridPanel" runat="server" 
                Border="false" 
                Title="TEST GRIDPANEL - user needs to select all (including header row) " 
                ForceFit="true">
                
                <Features>
                    <ext:Summary runat="server" ShowSummaryRow="true" />
                </Features>
    
                <View>
                    <ext:GridView EnableTextSelection="true" Selectable="true"></ext:GridView>
                </View>             
            </ext:GridPanel>
            
        </form>
    </body>
    </html>
    Last edited by fabricio.murta; May 17, 2019 at 5:42 PM.

Similar Threads

  1. Replies: 0
    Last Post: Aug 09, 2016, 6:23 AM
  2. Replies: 4
    Last Post: Sep 14, 2015, 6:06 AM
  3. Replies: 2
    Last Post: Sep 12, 2015, 11:04 AM
  4. Replies: 1
    Last Post: Nov 12, 2012, 2:29 PM
  5. Replies: 4
    Last Post: Oct 11, 2011, 2:42 AM

Posting Permissions