1. #41
    Sencha User steffenk's Avatar
    Join Date
    Jul 2007
    Location
    Haan, Germany
    Posts
    2,664
    Vote Rating
    7
    steffenk has a spectacular aura about steffenk has a spectacular aura about steffenk has a spectacular aura about

      0  

    Default


    Quote Originally Posted by jgarcia@tdg-i.com
    i think this should be added to the base!
    +1

    btw - Condor, do you have your complete overrides somewhere? You posted so much useful ones, thanks for that!
    vg Steffen
    --------------------------------------
    Release Manager of TYPO3 4.5

  2. #42
    Ext User
    Join Date
    Nov 2009
    Posts
    77
    Vote Rating
    0
    saadkhan is on a distinguished road

      0  

    Default


    Hi Condor,
    I am looking for daysss to how to add fields dynamically into my XMLReader seeing xml. I dont ahve anyyyyyy idea how to do this. I have an xml that I am parsing at runtime to setup fields of my XmlReader of my Grid. Pleassssssseeeee help.....nobody is responding to my threads asking same!!!!!!!!!!!!

    Code:
    var statusStore = new Ext.data.Store({
        storeId: 'statusStore',
        proxy: new Ext.data.MemoryProxy(''),
        reader: new Ext.data.XmlReader(
            {
                record: 'Status'
            },
            [
                 // Here more fields should be add at run time
                {name: 'DateAndTime', mapping: '@DateAndTime'}
            ]
            )
    });
    
    var statusGrid = new Ext.grid.GridPanel({
        id: 'statusGrid',
        title: 'Status',
        store: statusStore,
        hideHeaders: true,
        trackMouseOver: false,
        autoWidth: false,
        columns:
        [
         // I want to have only only column
            {id: '_dateAndTime', header: "DateAndTime", dataIndex: 'DateAndTime', renderer: statusRenderer}
        ],
        viewConfig: 
        {
            forceFit: true
        },
        autoExpandColumn: '_dateAndTime'
    });
    
    function statusRenderer(value, p, r)
    {
        var arr = [];
        var statusStore = Ext.StoreMgr.get('statusStore');
        statusStore.each(function(record)
        {
            arr.push(record.data.title,  '<br />', record.data.state, '<br />', record.data.description, '<br /><br />');
        });
        return arr.join('');
    }
    I am reading my xml something like that in order to add fields into my reader at runtime:

    Code:
    function RecieveStatusXML(str) {
            var statusXml = StringToXml(strrr);
            
            var statusStore = Ext.StoreMgr.get('statusStore');
            var childs = statusXml.documentElement.childNodes.item(0).childNodes;
            var recData = [];
            for(var x=0; x < childs.length; x++)
            {
                var TopicRecord = Ext.data.Record.create(
                    [
                        {name: "'" + childs.item(x).tagName + "Description'", mapping: "'" + childs.item(x).tagName + " > @Description'" },
                        {name: "'" + childs.item(x).tagName + "State'", mapping: "'" + childs.item(x).tagName + " > @State'" }
                    ]
                );
                var myNewRecord = new TopicRecord(
                    {
                        title: childs.item(x).tagName,
                        state: childs.item(x).attributes[0].nodeValue,
                        description: childs.item(x).attributes[1].nodeValue
                    }
                );
                recData.push(myNewRecord);            
            }
            // Dont know where to add these fields ???????????
    	}
    Here is my sample XML:

    Code:
    <Statuses>
              <Status DateAndTime='date'>
                  <Door State='1' Description='desc' />
                  <Acc State='2' Description='sadasd sad r' />
                  <St State='0' Description='lpc' />
                   ....
              </Status>
    </Statuses>

  3. #43
    Sencha User
    Join Date
    Jan 2009
    Posts
    79
    Vote Rating
    0
    lakilevi is on a distinguished road

      0  

    Default


    Hello.
    I like realy much this extension and I would use it in my application.
    But I have aproblem. I add in the fly a column to the grid, but when I reload the store, than the grid is empty.
    Here is my code:
    Code:
    var preview_store = new Ext.data.Store({
       reader: new Ext.data.JsonReader({fields: ['name'],root: 'rows'}),
       proxy: new Ext.data.HttpProxy({
        url: 'modules/contacts/jax_import/build_preview.jax.php',
        method:'post',
        success: function ( result, request ) {store.commitChanges();},
        failure: function ( result, request) {Ext.MessageBox.alert('<?=$lang->trans("Failed")?>', result.responseText);}         
       })
     });
     
     
     var preview_grid = new Ext.grid.GridPanel({    
        stripeRows:true,
        store: preview_store,                   
        loadMask: true,      
        height:230,
        cm: new Ext.grid.ColumnModel([{header:'Company name',dataIndex:'name'}]),
        autoScroll:true,
        viewConfig:{emptyText:'<?=$lang->trans('No entries')?>.'}    
        });
     
    preview_grid.addColumn({header: 'first_name', dataIndex: 'first_name'});    
           preview_store.baseParams={'cols':tmp, filename:uploaded_file, 'target':target_selector.getValue()};       
           preview_store.load();
    and here is my output of the ajax request:
    Code:
    {success: true,rows:[{"first_name":"1","name":"Google"}]}
    Thank you very much for your help!

  4. #44
    Sencha User
    Join Date
    Jan 2009
    Posts
    79
    Vote Rating
    0
    lakilevi is on a distinguished road

      0  

    Default


    there is something with the store.load ...
    if I insert the code:
    Code:
    preview_store.load({callback: function(r,o,s){console.dir(r);alert(preview_store.getCount());}  });
    than alerts 0. But if I take out the line with preview_grid.addColumn(...) than it loads well... What can be the problem?

  5. #45
    Sencha User
    Join Date
    Jan 2009
    Posts
    79
    Vote Rating
    0
    lakilevi is on a distinguished road

      0  

    Default


    With post #37 I solved the problem. Thanks Izhaki

  6. #46
    Ext User alebar's Avatar
    Join Date
    Apr 2010
    Posts
    21
    Vote Rating
    0
    alebar is on a distinguished road

      0  

    Default How to make it faster?

    How to make it faster?


    Hi,

    When I use this solution to add new columns in the grid with big number of columns (from hundreds to thousands) it is very very slow.

    Is it expected or apparently I do sth wrong?

    Thanks in advance for any suggestions.

  7. #47
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    97
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    Quote Originally Posted by alebar View Post
    Hi,

    When I use this solution to add new columns in the grid with big number of columns (from hundreds to thousands) it is very very slow.

    Is it expected or apparently I do sth wrong?

    Thanks in advance for any suggestions.
    That is to be expected. If you want to add a large number of columns then you should use:
    Code:
    grid.getColumnModel().setConfig(newColumns);

  8. #48
    Ext User alebar's Avatar
    Join Date
    Apr 2010
    Posts
    21
    Vote Rating
    0
    alebar is on a distinguished road

      0  

    Default


    Quote Originally Posted by Condor View Post
    That is to be expected. If you want to add a large number of columns then you should use:
    Code:
    grid.getColumnModel().setConfig(newColumns);
    Thank you so much. I'm gonna try it!

  9. #49
    Sencha User
    Join Date
    Nov 2007
    Posts
    294
    Vote Rating
    0
    Sesshomurai is on a distinguished road

      0  

    Default


    Any tips how to make this work with GridFilters, which need the column data too?

  10. #50
    Sencha User
    Join Date
    Sep 2009
    Posts
    53
    Vote Rating
    0
    vmadman is on a distinguished road

      0  

    Default Ext 3.2

    Ext 3.2


    Has anyone had trouble with the code working on ExtJS 3.2?

    I recently upgraded from 3.0.0

    Thanks,
    Luke