Results 1 to 3 of 3

Thread: Dynamic Grid Construct Issue.

  1. #1
    Sencha User
    Join Date
    Apr 2012
    Posts
    55
    Answers
    2

    Default Dynamic Grid Construct Issue.

    Hi,

    I am trying to create dynamic grid panel using response xml .

    The grid is displayed but data not populated.
    Please help me to solve this issue.

    Here is my code:

    loadData : function() {

    var sessionId=Ext.getCmp('sessionStore').value;
    var buId=Ext.getCmp('buidStore').value;
    var xmlFileName="D:\\Workspace4.1\\xgenerationV4.3.EXTJS\\resources\\xml\\viewsBuilder.xml";

    Ext.Ajax.request({
    type: 'ajax',
    url: '/dailypriorityactions/ViewsBuilderCommonServlet',
    disableCaching: false,
    params: {
    asession: sessionId,
    buid: buId,
    fileName: xmlFileName
    },
    reader: {
    type: 'xml'
    },
    scope: this,
    success: this.onViewLoadSuccess
    });

    },

    onViewLoadSuccess : function(response, opts){

    var gridColumns = [];
    var storeFields = [];
    var storeData = [];

    var str = response.responseText;

    alert(str);
    var dq = Ext.DomQuery;
    //var responseXML = response.xml;
    var columnArr=new Array();
    var itemNodes = Ext.DomQuery.select('nodes', response.responseXML);

    debugger;


    Ext.each(itemNodes, function(item){


    for(var i=0;i<item.childNodes.length;i++){

    storeData[i]={};
    // storeData[i]=item.childNodes[i].nodeName+":"+item.childNodes[i].textContent;
    // storeData[i]=":";
    storeData[i]=item.childNodes[i].textContent;

    // model.set(item.childNodes[i].nodeName,item.childNodes[i].textContent);

    storeFields[i] = {};
    storeFields[i].name = item.childNodes[i].nodeName;
    storeFields[i].type = 'String';

    gridColumns[i]={};
    gridColumns[i].text=item.childNodes[i].nodeName;
    gridColumns[i].flex=1
    gridColumns[i].dataIndex=item.childNodes[i].nodeName;
    }
    }, this);

    Ext.getCmp('dynamicAlertView').headerCt.add(gridColumns);

    // var jsonData = Ext.util.JSON.decode(response.responseText);

    // var jsonData= Ext.decode(response.responseText);

    Ext.define('model', {
    extend: 'Ext.data.Model',
    fields: storeFields
    });


    var store = new Ext.data.Store({
    // fields: storeFields,
    datatoreData,
    model:model,
    autoLoad: true
    });

    Ext.getCmp('dynamicAlertView').bindStore(store);
    }


    Please help me to solve this issue.. its highly priority task.

    Thanks in advance.

  2. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,448
    Answers
    3997

    Default

    Why not use the metachange event on the store and have the store load the xml?
    Mitchell Simoens @LikelyMitch

    Check out my GitHub:
    https://github.com/mitchellsimoens

    Posts are my own, not any current, past or future employer's.

  3. #3
    Ext JS Premium Member
    Join Date
    Feb 2009
    Posts
    487
    Answers
    4

    Default

    Quote Originally Posted by mitchellsimoens View Post
    Why not use the metachange event on the store and have the store load the xml?
    From the docs:

    Fires when this proxy's reader provides new metadata. Metadata usually consists of new field definitions, but can include any configuration data required by an application, and can be processed as needed in the event handler. This event is currently only fired for JsonReaders. Note that this event is also propagated by Ext.data.Store, which is typically where it would be handled.

Posting Permissions

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