View Full Version : Get All Data From GridPanel

Jul 30, 2015, 7:18 AM

how i can get all data in gridpanel

in old version of Ext.Net
i Use This Code


var function = ViewDate(grid){

var GridViewData = Sys.Serialization.JavaScriptSerializer.serialize(E xt.getCmp(grid.id).getRowsValues());


the correct output like this


now i use Ext.net 3.2

but when i use this code Ext.getCmp(grid.id).getRowsValues();

Bring me something wrong

like this



Aug 13, 2015, 7:40 PM
Any help Plzzzzzzzzzzz

Aug 21, 2015, 1:45 PM
Hi @AbdallahAshour,

Please provide a test case to reproduce the problem.

Aug 26, 2015, 1:55 PM
hi mr @Daniil

i have gridpanel contain data
i need to get all data in the gridpanel

i need it in JavaScript
like this


i have grid panel like this

this is my test case
i have Column (DateColumn) title for that column is (lastChange)

When is don't contain data and i use the function to get data from grid panel i don't see that column (lastChange)


this my Image


but When that Column Contain Data he get data

like this but not for all


i need now function to get all data in the View (in JavaScript)

Plz Help me

Aug 26, 2015, 6:58 PM
Please try SubmitEmptyValue="Null".

<ext:ModelField Name="lastChange" Type="Date" SubmitEmptyValue="Null" />

Then if there is no value, it appears a null in a result of getRowsValues call .

Aug 27, 2015, 9:30 AM
thank you mr.@Daniil

another question how i can get data from grid panel like in view


the data in store:


in the View:

i want to get data from grid like view

Aug 27, 2015, 1:08 PM
Unfortunately, there is no such an option for getRowsValues.

You can go throught the data returned by a .getRowsValues() call and transform as needed.

Also you can try with

Ext.net.GridPrinter.convertData(grid, grid.headerCt.getGridColumns(), {});
and see if it does the job that you need.

Aug 31, 2015, 8:31 AM
thank you @Daniil Very much

yes it work
and that what i need

but i see simple problem

when column name contain (-) like this (Branch-Name)
it give me tow column (Branch-Name) and (BranchName)


Sep 07, 2015, 12:15 PM
Reproduced. I investigated why it happens. It might be required for the printing functionality.

Okay, I took Ext.net.GridPrinter.convertData as a base and adjusted it to the requirement.


<%@ Page Language="C#" %>

<script runat="server">
protected void Page_Load(object sender, EventArgs e)
if (!X.IsAjaxRequest)
Store store = this.GridPanel1.GetStore();
store.DataSource = new object[]
new object[] { "test11", "test21" },
new object[] { "test12", "test22" },
new object[] { "test13", "test23" }

<!DOCTYPE html>

<head runat="server">
<title>Ext.NET v3 Example</title>

var getGridPanelData = function (grid, config) {
var data = [],
columns = grid.headerCt.getGridColumns(),
config = config || {};

Ext.each(config.currentPageOnly ? grid.store.getRange() : grid.store.getAllRange(), function (record, index) {
var item = {},
i, len, c, meta, value;

for (i = 0, len = columns.length; i < len; i++) {
c = columns[i];

if (c.dataIndex) {
value = record.data[c.dataIndex];
meta = { tdCls: "", tdAttr: "", style: "" };
value = c.renderer ? c.renderer.call(c, value, meta, record, index, i, grid.store, grid.view) : value;
item[c.dataIndex] = value;
} else if (c.isXType("rownumberer")) {
meta = { tdCls: "", tdAttr: "", style: "" };
item[Ext.String.createVarName(c.id)] = c.renderer.call(c, null, meta, record, index, i, grid.store, grid.view); //index + 1;
} else if (column.isXType("templatecolumn")) {
value = c.tpl ? c.tpl.apply(record.data) : value;
item[Ext.String.createVarName(c.id)] = value;

item.__internalId = record.internalId;

return data;

var onButtonClick = function() {
<form runat="server">
<ext:ResourceManager runat="server" />

<ext:Button runat="server" Text="Get data" Handler="onButtonClick" />

<ext:GridPanel ID="GridPanel1" runat="server">
<ext:Store runat="server">
<ext:Model runat="server">
<ext:ModelField Name="test1" />
<ext:ModelField Name="test-2" />
<ColumnModel runat="server">
<ext:Column runat="server" Text="Test 1" DataIndex="test1" />
<ext:Column runat="server" Text="Test 2" DataIndex="test-2" />

Sep 10, 2015, 7:24 AM
thank you @Daniil Very much

It works as I want