View Full Version : How to download and save extjs-grid data in a txt-file

21 Dec 2010, 12:09 AM

I have a page containing a Ext.grid.GridPanel object (code see below). I'm now looking for a function how to download the data and save them in a txt file on the client. I.e. my intension is to create a button under the grid and by pressing the button, a file save dialog should appear asking the user where to save the data in a txt file.
Is this possible and if so, does anybody has a solution how to achieve this?
Thanks a lot for your help!

//some code.....

var vHostListGrid = new Ext.grid.GridPanel({
store: vHostListStore,
columns: [
id :'ip',
header : 'IP-Adresse',
width : 100,
sortable : true,
dataIndex: 'ipaddress'
//some more columns...
header : 'Typ',
width : 85,
sortable : true,
dataIndex: 'type'

height: 350,
width: 1050,
title: 'Subnet Host List',
// config options for stateful behavior
stateful: true,
stateId: 'grid'

var vPanel = new Ext.FormPanel({
title: 'List',
id: 'HostList',
closeable: false,
bodyStyle:'padding:5px 5px 0',
autoWidth : true,
layout: 'hbox',
width: 280,
height: 116,
padding: 10,
buttonAlign: 'center',
tools: tools,
xtype: 'container',
layout: 'form',
margins: '0 10 0 0',
items: [
//Here code for the button... ??????????

20 Apr 2011, 5:00 AM
Did you ever solve this issue? I saw the Excel example, but I'd rather have a more universal file format.