Results 1 to 3 of 3

Thread: Table/grid Title dynamically assigned

  1. #1
    Sencha User
    Join Date
    Sep 2013
    Posts
    12
    Answers
    1

    Default Table/grid Title dynamically assigned

    The operation I want to do is not easy.I have a first grid (or table) and a secondo one, generated clicking on a cell which is present in every row of the first table. It takes the parameters of the first table and shows some other content of the json which generates the tables.

    The second table is included in a column of the first table, it is made by an ajax call and:
    Code:
    Ext.create('Ext.window.Window' etc. etc.
    The Problem is that i want to take the name of the row of the first table an use it as the name of the second table, which is inside the first. I've found some useful advices (1, 2) but the work for the "current" table, not for my specific case. Anyone can help?

    The code i use is below:

    Code:
      var grid = Ext.create('Ext.ux.LiveSearchGridPanel', {
            store: store1,
            stateful: true,
            collapsible: true,
            multiSelect: true,
            stateId: 'stateGrid',
            columns: [
                {
                    text     : 'id',
                    flex     : 1,
                    sortable : true,
                    dataIndex: 'id'
                },
                {
                    text     : 'buyer_member_id',
                    width    : 75,
                    sortable : true,
                    dataIndex: 'buyer_member_id'
                },
                {
                    text     : 'Client Name',
                    width    : 200,
                    sortable : true,
                    dataIndex: 'name'
                },
                {
                    xtype : 'actioncolumn',
                    width : '5%',
                    sortable : false,
                    items : [{
                        icon : '../static/accept.gif',
                        tooltip : 'See Admants',
                        handler : function(grid, rowIndex, colIndex){
                            var row = grid.getStore().getAt(rowIndex);
                             var buyer_member_id = row.data.buyer_member_id;
                            Ext.Ajax.defaultHeaders = {
                                "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
                            };
                            Ext.Ajax.request({
                                method : "GET",        
                                url: '/admants/?buyer_member_id='+ buyer_member_id,
                                success : function(response) {
                                    var obj = response;
                                    try {
                                        obj = Ext.decode(response.responseText);
                                    } catch (error) {alert("Errore nella decodifica del file json");}
                                    if (obj) { 
                                        Ext.define('Admants', {
                                        extend: 'Ext.data.Model',
                                        fields: [
                                              {name: 'id',    type: 'int', convert: null,    defaultValue:undefined},
                                              {name: 'name',  type: 'string', convert:null,  defaultValue:undefined},
                                              {name: 'group', type: 'string', convert:null,  defaultValue:undefined}
                                        ],
                                        idProperty: 'id'
                                        });
                                        var groupingFeature = Ext.create('Ext.grid.feature.Grouping',{
                                                groupHeaderTpl: 'Group: {name} ({rows.length} Item{[values.rows.length > 1 ? "s" : ""]})'
                                        });
                                        var Admantstore = Ext.create('Ext.data.Store', {
                                                autoLoad: true,
                                                storeId: 'Admants',
                                                sorters: ['id', 'name','group'],
                                                groupField: 'group',
                                                fields: ['id','name','group'],
                                                data : obj,
                                                model: 'Admants',
                                                proxy: {
                                                    type: 'memory',
                                                    reader: {
                                                        type: 'json',
                                                        root: 'admants'
                                                    }
                                                }
                                            });
                                        Ext.create('Ext.window.Window', {
                                        title: 'Admants', //this line has to be changed
                                        height: 200,
                                        width: 400,
                                        layout: 'fit',
                                        items: {  
                                        xtype: 'grid',
                                        border: false,
                                        store: Admantstore,
                                        features: [groupingFeature],
                                        columns: [
                                                {
                                                    text     : 'id',
                                                    flex     : 1,
                                                    sortable : true,
                                                    dataIndex: 'id'
                                                },
                                                {
                                                    text     : 'name',
                                                    width    : 300,
                                                    sortable : true,
                                                    dataIndex: 'name'
                                                }],
                                        }}).show();
                                    } else {
                                    alert("Invalid response");
                                    }
                                },
                                failure : function(response) {
                                    alert("Data request failed");
                                }
                            });    
                        }
                    }]
                }
            ],
            height: 350,
            width: 600,
            title: 'Member Data Sharing',
            renderTo: 'grid-example1',
            viewConfig: {
                stripeRows: true,
                enableTextSelection: true
            }
        });
    });

  2. #2
    Sencha User
    Join Date
    Sep 2013
    Posts
    12
    Answers
    1

    Default Here is the solution i found

    In this web page is described the solution of this problem

  3. #3
    Sencha User
    Join Date
    Feb 2013
    Location
    California
    Posts
    11,985
    Answers
    506

    Default

    Thanks for giving back to the community by posting your solution.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •