PDA

View Full Version : Simple editable array with gridpanel - looking for!



NestorLeone
Dec 11, 2009, 4:11 PM
After checking out the samples in the samples explorer and not getting it, I turn to this spot.

I want to use a gridpanel to make a small list I have in an array, editable (add-edit-remove) but I'm having problems doing so.

First I can't make the gridpanel to show the array contents. Second I don't get the updates to the grid, reflected on the array.- Evidently they are not getting hooked up.

the data store is defined like this :



<ext:Store ID="UsersStore" runat="server">
<Reader>
<ext:ArrayReader>
<Fields>
<ext:RecordField Name="ContactID" />
<ext:RecordField Name="AccountID" />
<ext:RecordField Name="Name" />
<ext:RecordField Name="PhoneNumber" />
<ext:RecordField Name="PhoneType" />
</Fields>
</ext:ArrayReader>
</Reader>
</ext:Store>



The gridpanel has the following definition;



<ext:GridPanel ID="UsersGrid" runat="server"
Title = "Users" StoreID="UsersStore" Height="200"
Border = "false"
Frame = "True"
StripeRows = "True"
MemoryIDField = "ContactID"
TrackMouseOver = "True"
>
<ColumnModel runat="server">
<Columns>
<ext:Column DataIndex="ContactID" ColumnID="ContactID" Hidden="true" />
<ext:Column DataIndex="Name" Header="Name">
<Editor><ext:TextField ID="TextField1" runat="server" /></Editor>
</ext:Column>
<ext:Column DataIndex="PhoneNumber" Header="Phone">
<Editor><ext:TextField ID="TextField2" runat="server" /></Editor>
</ext:Column>
<ext:Column DataIndex="PhoneType" Header="Phone Type">
<Editor>
<ext:ComboBox
ID="ComboBox3"
runat="server"
Editable="false"
EmptyText="">
<Items>
<ext:ListItem Text="cell" Value="cell" />
<ext:ListItem Text="home" Value="home" />
<ext:ListItem Text="work" Value="work" />

</Items>
</ext:ComboBox>
</Editor>
</ext:Column>
</Columns>
</ColumnModel>
</ext:GridPanel>



In code behind I bind the array to the store Store and the grid..






UsersStore.DataSource = arrUsers.value

UsersStore.DataBind()

UsersGrid.DataBind()





But nothing happens.. any ideas of where I'm messing it up?

Next, this way, does the gridpanel object update the array? Or just the Store? is it neccesary to make some other stuff in order the have the array with the data modified in the grid??

Thanks you guys!

NestorLeone
Dec 16, 2009, 11:11 AM
This is sad... almost a week and no replies!

Vladimir
Dec 16, 2009, 11:33 AM
Hi,

The information which you provided is not enought to get you an answer


1. What data do you bind (it should be array of arrays)?
2. How you try to get updates to the grid?


Provide full sample which shows how all is configured


Please post technical questions inside Help forum branch

NestorLeone
Dec 16, 2009, 1:05 PM
Hi Vlasdch, Yes my bad. wrong forum.. sorry. (Can you move it ?)

On the specific technical data, the datasource of the grid is an arraylist of arrays.

About the updates I'm asking about, is if the data in the grid is manually modified by the user, those modifications, are reflected in the store or in the array directly ? i mean, after the user hits "continue" to submit the page, where do i find the modifications done in the grid?

NestorLeone
Dec 17, 2009, 9:29 AM
so ?

Vladimir
Dec 18, 2009, 9:27 AM
Hi,

Unfortunatelly the ArrayReader cannot handle ArrayList. It should be array.


where do i find the modifications done in the grid?
You have to call save for the grid and handle save request on the server side. The examples explorer has a few examples which demonstrate how to save grid data. Also you can submit grid - whole data submit but changes
Examples in Examples Explorer


- GridPanel/WebService Connections branch
- GridPanel/Miscellaneous/Submit Two Grids
- GridPanel/DataSource Update/SqlDataSource