Gelmiş geçmiş en büyük porno sitemiz olan 2pe de her zaman en kaliteli pornoları sunmayı hedefledik. Diğer video sitemiz olan vuam da ise hd porno ağırlıklı çalışmalara başladık.

  1. #1
    Sencha Premium Member dnoizet's Avatar
    Join Date
    Aug 2012
    Posts
    77
    Vote Rating
    0
    dnoizet is an unknown quantity at this point

      0  

    Question Unanswered: GroupingSummary + XMLStore + remoteRoot ?

    Unanswered: GroupingSummary + XMLStore + remoteRoot ?


    Hi,

    I'm trying to use the GroupingSummary feature of the ExtJS grids. I use a XLMStore to retrieve the data. I need the summary lines to be retrieved from the XML file, they can't be computed locally. So I have to use the remoteRoot property.
    The grid displays the data just fine, but the summary line appears empty.

    I do not know precisely how should the summary data appear in the XML file (the given example in the official documentation uses a JSONStore).

    Here is an example of the current structure of my XML file (dummy data and field names) :

    Code:
    <mydata>
    <total>3</total> <mydataRow>
    <a>000</a> <b>aaa</b>
    </mydataRow>
    <mydataRow>
    <a>000</a> <b>bbb</b>
    </mydataRow> <mydataRow>
    <a>001</a> <b>ccc</b>
    </mydataRow>
    <mydataSummary>
    <mydataSummaryRow>
    <a>000</a> <b>1234</b>
    </mydataSummaryRow>
    <mydataSummaryRow>
    <a>001</a> <b>1234</b>
    </mydataSummaryRow>
    </mydataSummary>
    </mydata>
    So I set the XMLreader properties like follow:
    Code:
    {
    type: "xml", root: "mydata", record: "mydataRow"
    }
    Then I add a GroupingSummary feature object to the grid:
    Code:
    features:
    [
    {
    ftype: 'groupingsummary', groupHeaderTpl: [
    '{name}'
    ], startCollapsed: true, remoteRoot: 'mydataSummary'
    }
    ]
    Lets say I set the grouping field to "a" in the store.

    Then I load my store. No JavaScript errors thrown.

    The grouping summary line appears but is empty.

    If I try to name the summary rows to "mydataRow" instead of "mydataSummaryRow", then the summary rows appear like normal rows in the grid, and the grouping summary rows are still empty.
    I tried that because I saw that when the summary rows are retrieved, the XMLReader is reused. Its root property is changed temporarily from "mydata" to "mydataSummary" but the record property does not get changed, it stays at "mydataRow".

    Any help would be much appreciated.

    Gabriel
    Last edited by dnoizet; 3 Sep 2012 at 10:40 PM. Reason: precision, clarity, fixed typo

  2. #2
    Sencha - Community Support Team
    Join Date
    Jan 2012
    Posts
    1,376
    Answers
    346
    Vote Rating
    113
    vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all

      0  

    Default


    FYI:
    Code:
    Ext.onReady(function(){
        var grid = Ext.create('Ext.grid.Panel', {
            width: 300,
            height: 300,
            renderTo: Ext.getBody(),
            features: [{
                ftype: 'groupingsummary',
                groupHeaderTpl: 'Subject: {name}',
            }],
            store: {
                type: 'store',
                fields: [{name: 'a', type: 'int'}, 'b'],
                groupField: 'b',
                autoLoad: true,
                proxy: {
                    type: 'ajax',
                    url: 'index.xml',
                    reader: {
                        type: 'xml',
                        root: 'mydata',
                        record: 'mydataRow'
                    }
                }
            },
            columns: [{
                text: 'B',
                dataIndex: 'b'
            },{
                text: 'A',
                dataIndex: 'a',
                summaryType: 'sum'
            }]
        });
    });
    index.xml
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <mydata>
        <mydataRow>
            <a>1</a>
            <b>aaa</b>
        </mydataRow>
        <mydataRow>
            <a>2</a>
            <b>bbb</b>
        </mydataRow>
        <mydataRow>
            <a>3</a>
            <b>ccc</b>
        </mydataRow>
        <mydataRow>
            <a>4</a>
            <b>aaa</b>
        </mydataRow>
        <mydataRow>
            <a>5</a>
            <b>bbb</b>
        </mydataRow>
    </mydata>

  3. #3
    Sencha Premium Member dnoizet's Avatar
    Join Date
    Aug 2012
    Posts
    77
    Vote Rating
    0
    dnoizet is an unknown quantity at this point

      0  

    Default


    Hi,

    Thank you for your reply, but unfortunately that is not what I need. I need to compute the grouping summary lines on the server side. That's why I wish to use the remoteRoot property.

    Do you know if that is even possible with an XML store ?

    Thank you for your time.

    Gabriel

  4. #4
    Sencha - Community Support Team
    Join Date
    Jan 2012
    Posts
    1,376
    Answers
    346
    Vote Rating
    113
    vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all

      0  

    Default


    Try this:
    Code:
    Ext.onReady(function(){
        var grid = Ext.create('Ext.grid.Panel', {
            width: 300,
            height: 300,
            renderTo: Ext.getBody(),
            features: [{
                ftype: 'groupingsummary',
                remoteRoot: 'mydataSummary',
                groupHeaderTpl: 'Subject: {name}'
            }],
            store: {
                type: 'store',
                fields: [{name: 'a', type: 'int'}, 'b'],
                groupField: 'b',
                autoLoad: true,
                proxy: {
                    type: 'ajax',
                    url: 'index.xml',
                    reader: {
                        type: 'xml',
                        root: 'mydata',
                        record: 'mydataRow',
                        getRoot: function(data) {
                            var nodeName = data.nodeName,
                                root     = this.root;
    
    
                            if (!root || (nodeName && nodeName == root)) {
                                return data;
                            } else if (Ext.DomQuery.isXml(data)) {
                                return Ext.DomQuery.select(root, data);
                            }
                        }
                    }
                }
            },
            columns: [{
                text: 'B',
                dataIndex: 'b'
            },{
                text: 'A',
                dataIndex: 'a'
            }]
        });
    });
    index.xml
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <root>
        <mydata>
            <mydataRow>
                <a>1</a>
                <b>aaa</b>
            </mydataRow>
            <mydataRow>
                <a>2</a>
                <b>bbb</b>
            </mydataRow>
            <mydataRow>
                <a>3</a>
                <b>ccc</b>
            </mydataRow>
            <mydataRow>
                <a>4</a>
                <b>aaa</b>
            </mydataRow>
            <mydataRow>
                <a>5</a>
                <b>bbb</b>
            </mydataRow>
        </mydata>
        <mydataSummary>
            <mydataRow>
                <a>50</a>
                <b>aaa</b>
            </mydataRow>
        </mydataSummary>
        <mydataSummary>
            <mydataRow>
                <a>70</a>
                <b>bbb</b>
            </mydataRow>
        </mydataSummary>
        <mydataSummary>
            <mydataRow>
                <a>30</a>
                <b>ccc</b>
            </mydataRow>
        </mydataSummary>
    </root>

  5. #5
    Sencha Premium Member dnoizet's Avatar
    Join Date
    Aug 2012
    Posts
    77
    Vote Rating
    0
    dnoizet is an unknown quantity at this point

      0  

    Default


    Thank you, it seems to work, although I don't understand what is that getRoot function (it's not documented in XMLReader) and why do you have to wrap each summary row "mydataRow" in a "mydataSummary" element instead of having one "mydataSummary" with several "mydataRow"... Could you explain please ?

  6. #6
    Sencha Premium Member dnoizet's Avatar
    Join Date
    Aug 2012
    Posts
    77
    Vote Rating
    0
    dnoizet is an unknown quantity at this point

      0  

    Default


    Correction, it is a little documented here http://docs.sencha.com/ext-js/4-1/#!...method-getRoot

Thread Participants: 1

Tags for this Thread