PDA

View Full Version : [CLOSED] how to add several blank row to the gridpanel



hdsoso
May 17, 2013, 6:19 AM
insert 4 blank row when page is loaded. when user fill in the cell then click save button, then save to the database's table.
do you have an example?

hdsoso
May 17, 2013, 6:50 AM
mycode
aspx:


<ext:GridPanel runat="server" ID="gp_pingzheng">
<Store>
<ext:Store runat="server" ID="store_pz">
<Model>
<ext:Model runat="server">
<Fields>
<ext:ModelField runat="server" Name="Digest"></ext:ModelField>
<ext:ModelField runat="server" Name="Ccode"></ext:ModelField>
<ext:ModelField runat="server" Name="Jfsl"></ext:ModelField>
<ext:ModelField runat="server" Name="Dfsl"></ext:ModelField>
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<ColumnModel>
<Columns>
<ext:Column runat="server" Text="摘要" Flex="2" DataIndex="Digest">
<Editor>
<ext:TextField runat="server"></ext:TextField>
</Editor>
</ext:Column>
<ext:TreeColumn runat="server" Text="会计科目" Flex="1" DataIndex="Ccode"></ext:TreeColumn>
<ext:NumberColumn runat="server" Flex="1" Text="借方金额" DataIndex="Jfsl">
<Editor>
<ext:NumberField runat="server"></ext:NumberField>
</Editor>
</ext:NumberColumn>
<ext:NumberColumn runat="server" Flex="1" Text="贷方金额" DataIndex="Dfsl">
<Editor>
<ext:NumberField runat="server"></ext:NumberField>
</Editor>
</ext:NumberColumn>
</Columns>
</ColumnModel>
</ext:GridPanel>

server code:


protected void Page_Load(object sender, EventArgs e)
{
if (!X.IsAjaxRequest)
{

var ll = new List<Cwzz_AccVouchSub>();
for (int i = 0; i < 5; i++)
{
var accVouchSub = new Cwzz_AccVouchSub();
ll.Add(accVouchSub);
}
this.store_pz.DataSource = ll;
this.store_pz.DataBind();
}
}

it shows only five rows and every one has only one column(only one td )
what's the problem

Daniil
May 17, 2013, 11:57 AM
Hi @hdsoso,

I don't think it is possible to use a TreeColumn within a GridPanel. Please replace it with a common Column.