DataSourceProxy Export

  1. #1

    DataSourceProxy Export


    How can i export all data when using a


    <ext:DataSourceProxy />I've tried altering the export javascript work around but cannot get it to work.

    Any Help please

     
    
    
    var exportData = function (grid,hiddenFormat,format) 
    { 
    
    
        hiddenFormat.setValue(format); 
    
    
        var store = grid.store; 
    
    
        store.ajaxEventConfig.isUpload = true; 
    
    
        var records = store.reader.jsonData.data, 
    
    
        values = []; 
    
    
    
    
    
        for (i = 0; i < records.length; i++) 
    
    
        { 
    
    
            var obj = {}, dataR; 
    
    
    
    
    
            dataR = Ext.apply(obj, records[i].data); 
    
    
            if (!Ext.isEmptyObj(dataR)) 
    
    
            { 
    
    
                values.push(dataR); 
    
    
            } 
    
    
    
    
    
        } 
    
    
        store.submitData(values); 
    
    
        store.ajaxEventConfig.isUpload = false;
    
    
    }
  2. #2

    RE: DataSourceProxy Export

    Hi,

    You can't do that on client. If you use proxy then it is mean that data retrieve remotly.
    Just retrieve all required data on server side from source which use DataSourceProxy
  3. #3

    RE: DataSourceProxy Export

    Ok but i'm using the OnRefreshData of the store to bind to the grid, the grid has filters and is not populated on page load, the proxy is used but i'm guessing only for the page count.

    I need to export all the filtered data from the store. Is this possible?
    Thanks


    
    
    
    <ext:Store ID="Store1" runat="server" AutoLoad="false" OnSubmitData="Store1_Submit"
    
    
    OnRefreshData="Store1_Refresh">
    
    
    <AjaxEventConfig IsUpload="true" />
    
    
    <proxy>
    
    
    <ext:DataSourceProxy />
    
    
    </proxy>
    
    
    <Reader>
    
    
    
    protected void Store1_Refresh(object sender, StoreRefreshDataEventArgs e)
    
    
    {
    
    
    DataSet ds = new DataSet();
    
    
    ds = GridDataBind();
    
    
    if (ds.Tables[0].Rows.Count > 0)
    
    
    {
    
    
    Store1.DataSource = ds;
    
    
    e.TotalCount = Convert.ToInt32(ds.Tables[0].Rows[0]["count"]);
    
    
    Store1.DataBind(); 
    
    
    }
    
    
    }
  4. #4

    RE: DataSourceProxy Export

    Hi,

    Regarding your image the store contains 150 records only, other data in DB. Therefore grid can't get that data (from DB). You need retrieve data from DB and export data manually


    You can pass current filter to the server and use for retrieve data


    var filtersPlugin = {reference on plugin from grid.plugins collection};
    var curFilters= filtersPlugin.buildQuery(filtersPlugin.getFilterDa ta());


    How to use filters remotly see
    https://examples1.ext.net/#/GridPanel/Plugins/GridFilters_Remote/

Similar Threads

  1. Help with the export.
    By oscar_nadie in forum 1.x Help
    Replies: 0
    Last Post: May 16, 2011, 12:55 PM
  2. Replies: 1
    Last Post: Apr 19, 2010, 2:44 PM
  3. Export to CSV/XLS/XML
    By Filip Beunens in forum 1.x Help
    Replies: 7
    Last Post: Apr 02, 2009, 10:25 AM
  4. [CLOSED] GridPanel DataSourceProxy
    By Timothy in forum 1.x Legacy Premium Help
    Replies: 17
    Last Post: Feb 23, 2009, 2:09 PM
  5. can not get DataSourceProxy to work
    By styx in forum 1.x Help
    Replies: 2
    Last Post: Jan 31, 2009, 12:19 PM

Posting Permissions