[FIXED] [#295] [4.1.0] Summary remote and displaying all items from request

Page 2 of 2 FirstFirst 12
  1. #11
    Quote Originally Posted by Daniil View Post
    Hi Vladimir,

    Yes, I just think it should be defined in our AbstractSummary.cs as well as it is done in ExtJS.
    http://docs.sencha.com/extjs/4.2.1/#...cfg-remoteRoot
    Extra row at the end (when it should be at top). At top everything is like old(even when I made summrow element to have id equals to -1. What could cause that?
  2. #12
    Bad news.

    A Summary's RemoteRoot doesn't work. Here is a opened bug on the Sencha forums.
    http://www.sencha.com/forum/showthread.php?261179

    Created an Issue to monitor.
    https://github.com/extnet/Ext.NET/issues/295


    Good news.

    We can suggest the following workaround.

    1. The Summary configuration.
    <ext:Summary runat="server" Dock="Top" RemoteRoot="data.summaryData" />
    2. The JsonReader configuration.
    <ext:JsonReader 
        runat="server" 
        IDProperty="Id" 
        TotalProperty="data.total" 
        Root="data.data" />
    3. Change a ASHX's response to:

    context.Response.Write(JSON.Serialize(new
    {
        data = new Paging<object>(rangeData, data.Count),
        summaryData = new 
        { 
            Name = "Hello 1",
            Cost = 10000,
            Date = "Hello 2"
        }
    }));
    4. Add this override to the page's <head>.

    Ext.grid.feature.Summary.override({
        createSummaryRecord: function(view) {
            var columns = view.headerCt.getVisibleGridColumns(),
                info = {
                    records: view.store.getRange()
                },
                colCount = columns.length, i, column,
                summaryRecord = this.summaryRecord || (this.summaryRecord = new view.store.model(null, view.id + '-summary-record'));
    
            // Set the summary field values
            summaryRecord.beginEdit();
    
            if (this.remoteRoot) {
                if (view.store.proxy.reader.rawData) {
                    summaryRecord.set(view.store.proxy.reader.rawData.summaryData); // hardcoded "summaryData"
                }
            } else {
                for (i = 0; i < colCount; i++) {
                    column = columns[i];
    
                    // In summary records, if there's no dataIndex, then the value in regular rows must come from a renderer.
                    // We set the data value in using the column ID.
                    if (!column.dataIndex) {
                        column.dataIndex = column.id;
                    }
    
                    summaryRecord.set(column.dataIndex, this.getSummary(view.store, column.summaryType, column.dataIndex, info));
                } 
            }
    
            summaryRecord.endEdit(true);
            // It's not dirty
            summaryRecord.commit(true);
            summaryRecord.isSummary = true;
    
            return summaryRecord;
        }
    });
  3. #13
    Quote Originally Posted by Daniil View Post
    Bad news.

    A Summary's RemoteRoot doesn't work. Here is a opened bug on the Sencha forums.
    http://www.sencha.com/forum/showthread.php?261179

    Created an Issue to monitor.
    https://github.com/extnet/Ext.NET/issues/295


    Good news.

    We can suggest the following workaround.

    1. The Summary configuration.
    <ext:Summary runat="server" Dock="Top" RemoteRoot="data.summaryData" />
    2. The JsonReader configuration.
    <ext:JsonReader 
        runat="server" 
        IDProperty="Id" 
        TotalProperty="data.total" 
        Root="data.data" />
    3. Change a ASHX's response to:

    context.Response.Write(JSON.Serialize(new
    {
        data = new Paging<object>(rangeData, data.Count),
        summaryData = new 
        { 
            Name = "Hello 1",
            Cost = 10000,
            Date = "Hello 2"
        }
    }));
    4. Add this override to the page's <head>.

    Ext.grid.feature.Summary.override({
        createSummaryRecord: function(view) {
            var columns = view.headerCt.getVisibleGridColumns(),
                info = {
                    records: view.store.getRange()
                },
                colCount = columns.length, i, column,
                summaryRecord = this.summaryRecord || (this.summaryRecord = new view.store.model(null, view.id + '-summary-record'));
    
            // Set the summary field values
            summaryRecord.beginEdit();
    
            if (this.remoteRoot) {
                if (view.store.proxy.reader.rawData) {
                    summaryRecord.set(view.store.proxy.reader.rawData.summaryData); // hardcoded "summaryData"
                }
            } else {
                for (i = 0; i < colCount; i++) {
                    column = columns[i];
    
                    // In summary records, if there's no dataIndex, then the value in regular rows must come from a renderer.
                    // We set the data value in using the column ID.
                    if (!column.dataIndex) {
                        column.dataIndex = column.id;
                    }
    
                    summaryRecord.set(column.dataIndex, this.getSummary(view.store, column.summaryType, column.dataIndex, info));
                } 
            }
    
            summaryRecord.endEdit(true);
            // It's not dirty
            summaryRecord.commit(true);
            summaryRecord.isSummary = true;
    
            return summaryRecord;
        }
    });
    It's worked for me but on some pages it's generate those js errors:
    
    NS_ERROR_FAILURE: Failure
    doc.execCommand(cmd, false, (value == undefined ? null : value)); ext.axd?v=37843 (row 145305)
    
    TypeError: records is null
    
    window.eval.call(window, result.script);
    This is only fot NOTE. Thanks guys:) I'll wait for fix then for now it's enough.
  4. #14
    Sencha fixed the bug. The latest Ext.NET 3.x (3.3) and 4.x (4.0 and upcoming 4.1) includes this fix.

    The RemoteProperty has been added to the Ext.Net.AbstractSummary class in the upcoming 4.1.0 and it works well.
Page 2 of 2 FirstFirst 12

Similar Threads

  1. [CLOSED] Display value of sum all items when Store remote is on?
    By ViDom in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: Jun 28, 2013, 4:47 PM
  2. Replies: 3
    Last Post: Jun 25, 2013, 4:45 PM
  3. Replies: 0
    Last Post: Apr 18, 2013, 11:03 AM
  4. Grouping summary and summary in one grid
    By PetrSnobelt in forum 2.x Help
    Replies: 1
    Last Post: Apr 16, 2013, 9:59 AM
  5. [CLOSED] Remote grouping or grouping summary for GridPanel
    By jchau in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Nov 08, 2009, 10:23 PM

Tags for this Thread

Posting Permissions