Dec 10, 2013, 3:38 PM
[CLOSED] GridPanel Rendering takes time
In my Project a grid is taking around 30 seconds in rendering, given is some statistics.
Total records 200 approx.
Total Column 14 columns, 6 columns have renderer applied.
I was wondering how to provide the complete code as an example, but while I tried to bring 500 records in a grid. it takes 5 seconds to render.
Is it fair to take 5 seconds to render a grid with 500 records? Or there is a way to improve the rendering performance of the grid.
Given is the Screenshot, where its taking 6 seconds to render.
Given is the sample code.
View :
Total records 200 approx.
Total Column 14 columns, 6 columns have renderer applied.
I was wondering how to provide the complete code as an example, but while I tried to bring 500 records in a grid. it takes 5 seconds to render.
Is it fair to take 5 seconds to render a grid with 500 records? Or there is a way to improve the rendering performance of the grid.
Given is the Screenshot, where its taking 6 seconds to render.
Given is the sample code.
View :
@model System.Collections.IEnumerable
@{
ViewBag.Title = "Data Prepare - Ext.NET MVC Examples";
Layout = "~/Views/Shared/_BaseLayout.cshtml";
}
@section headtag
{
<script>
var prepareCity = function (value, record) {
return record.get('Address').City;
};
var prepareStreet = function (value, record) {
return record.get('Address').StreetAddress;
};
function afterrender() {
var currentdate = new Date();
var datetime = "Last Sync: " + currentdate.getDate() + "/" + (currentdate.getMonth() + 1)
+ "/" + currentdate.getFullYear() + " - "
+ currentdate.getHours() + ":"
+ currentdate.getMinutes() + ":" + currentdate.getSeconds();
alert(datetime)
}
</script>
}
@section example
{
@(DateTime.Now)
@(Html.X().GridPanel()
.Title("Customers")
.Width(630)
.Height(300)
.Listeners(l1 =>
{
l1.AfterRender.Handler = "afterrender();";
l1.AfterRender.Delay = 10;
})
.Store(Html.X().Store()
.Model(Html.X().Model()
.Fields(
new ModelField("ID", ModelFieldType.Int),
new ModelField("FirstName"),
new ModelField("LastName"),
new ModelField("Company"),
new ModelField()
{
Name = "Address",
Type = ModelFieldType.Object
},
new ModelField()
{
Name = "City",
Convert =
{
Fn = "prepareCity"
}
},
new ModelField()
{
Name = "Street",
Convert =
{
Fn = "prepareStreet"
}
}
)
)
.DataSource(Model)
)
.ColumnModel(
Html.X().Column().Text("ID").DataIndex("ID"),
Html.X().Column().Text("FirstName").DataIndex("FirstName"),
Html.X().Column().Text("LastName").DataIndex("LastName"),
Html.X().Column().Text("Company").DataIndex("Company"),
Html.X().Column().Text("City").DataIndex("City"),
Html.X().Column().Text("Street").DataIndex("Street")
)
)
}
Controller :using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace Ext.Net.MVC.Examples.Areas.GridPanel_Data_Presentation.Data_Prepare.Controllers
{
public class Data_PrepareController : Controller
{
public ActionResult Index()
{
return View(Customers.GetAll());
}
}
}
Model : using System;
using System.Collections;
using System.Collections.Generic;
namespace Ext.Net.MVC.Examples.Areas.GridPanel_Data_Presentation.Data_Prepare
{
public class Customer
{
public int ID { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public string Company { get; set; }
public Address Address { get; set; }
}
public class Address
{
public string StreetAddress { get; set; }
public string City { get; set; }
}
public class Customers
{
public static IEnumerable GetAll()
{
List<Customer> list = new List<Customer>(500);
for (int i = 1; i <= 500; i++)
{
Customer customer = new Customer
{
ID = i,
FirstName = ("FirstName" + i),
LastName = ("LastName" + i),
Company = ("Company" + i)
};
Address address = new Address
{
StreetAddress = ("Street" + i),
City = ("City" + i)
};
customer.Address = address;
list.Add(customer);
}
return list;
}
}
}
Last edited by Daniil; Dec 18, 2013 at 2:50 AM.
Reason: [CLOSED]