PDA

View Full Version : [CLOSED] how to show list of string in gridpanel?



tobros
Oct 25, 2013, 8:56 AM
protected void LoadData(object sender, StoreReadDataEventArgs e)
{
int start = e.Start;
int limit = e.Limit;
int total = 0;
// var l = accVouchMainService.PageDdate(start, limit, out total);
// var pagingList = new Paging<string>(l, total);
var l = new List<string>
{
"1981-01-02",
"1982-01-02",
"1983-01-02",
"1984-01-02",
"1985-01-02"
};
// e.Total = pagingList.TotalRecords;
e.Total = 21;
// s_AccVouchMain.DataSource = pagingList.Data;
s_AccVouchMain.DataSource = l;
s_AccVouchMain.DataBind();
}



<ext:GridPanel runat="server" Title="现金流量数据调整">
<Store>
<ext:Store runat="server" ID="s_AccVouchMain" OnReadData="LoadData">
<Model>
<ext:Model runat="server" IDProperty="VouchId">
<Fields>
<ext:ModelField runat="server" Name="Ddate"></ext:ModelField>
</Fields>
</ext:Model>
</Model>
<Proxy>
<ext:PageProxy></ext:PageProxy>
</Proxy>
</ext:Store>

</Store>
<ColumnModel>
<Columns>
<ext:DateColumn runat="server" DataIndex="Ddate" Format="yyyy-MM-dd" Text="日期" Flex="1"></ext:DateColumn>
</Columns>
</ColumnModel>
<BottomBar>
<ext:Toolbar runat="server">
<Items>
<ext:PagingToolbar runat="server" StoreID="s_AccVouchMain"></ext:PagingToolbar>
</Items>
</ext:Toolbar>
</BottomBar>
</ext:GridPanel>

Daniil
Oct 25, 2013, 1:43 PM
Hi @tobros,

This way:

var l = new object[]
{
new object[] { "1981-01-02" },
new object[] { "1982-01-02" },
new object[] { "1983-01-02" },
new object[] { "1984-01-02" },
new object[] { "1985-01-02" }
};


<ext:PageProxy>
<Reader>
<ext:ArrayReader />
</Reader>
</ext:PageProxy>

Vladimir
Oct 25, 2013, 1:52 PM
Or you can convert list of string to the list of object


var l = new List<string>
{
"1981-01-02",
"1982-01-02",
"1983-01-02",
"1984-01-02",
"1985-01-02"
};
var data = l.Select(s => new { Ddate = s });