C# バックエンドを使用して extjs グリッド pangel にページング ツールバーを実装しようとしています...どうすればそれを開始できますか... start と limit を使用してみましたが、どのように機能するかわかりません。私のグリッドは500個のデータすべてを取得しているため、グリッドでページごとに約20レコードを送信する方法について誰か助けてください.
public JsonResult getData(int start, int limit)
{
List<MyItem> items = new List<MyItem>();
using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["ApplicationServices1"].ConnectionString))
{
SqlCommand cmd = con.CreateCommand();
cmd.CommandText = "SELECT State, Capital FROM MYDBTABLE";
con.Open();
SqlDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
MyItem item = new MyItem();
item.State = reader[0].ToString();
item.Capital = reader[1].ToString();
items.Add(item);
}
con.Close();
return Json(new { myTable = items }, JsonRequestBehavior.AllowGet);
}
}
そして、これは私の店です
this.store = Ext.create('Ext.data.JsonStore', {
autoLoad: true,
storeId: 'mystore1',
pageSize: 20,
fields: [
{ name: 'State' },
{ name: 'Capital' }
],
sorters: [
{
property: 'State',
direct: 'ASC'
}],
scope: this,
proxy: {
type: 'ajax',
scope: this,
url: 'StateC/getData',
autoLoad: { params: {
start: 0,
limit: 20
}
},
reader: {
type: 'json',
root: 'myTable'
}
}
});