View Full Version : [CLOSED] Pb with update on HttpProxy/StoreDataHandler

Oct 08, 2008, 11:40 AM
Sorry to bother you again, but i'm clueless about this problem.
I'm trying to update some records from a gridpanel, with the help of the "HandlerUsing" sample. Only difference is that i'm using JSON serialization instead of XML.
I just can't understant why on my handler, updated records un the StoreDataHanlder looks like this :

"PrenomAdministrateur":"John","EmailAdministrateur":"<A href='mailto:john@dupond.net","CleMD5PwdAdministrateur":"43C32AEFEB5480D98E5DF2EEAD2A4297","CompteAdministrateurActif":true,"IdUtilisateurCreation":"tempId","IdUtilisateurModification":"tempId","DateCreation":"2008-07-10T18:09:44","DateModification":"2008-08-01T15:22:49'>john@dupond.net",

which looks fine, while my changeRecords doens't store any AdministrateurID. Other fiels are perfectly fines, and the changed values are sent properly.
The ReaderID of my JsonReader is set to AdministrateurID (I believe this is how it should be), but I can't find anything else in the sample about how to handle Primary keys.
What am I missing here?

Oct 08, 2008, 12:59 PM
Does the AdministrateurID present in GridPanel as Column and in store as field? Can you try to remove this column and field (but leave ReaderID as is ReaderID = "AdministrateurID "). I am not sure (and I'll investigate) but if Store contains Field which is id then can be some problems. I'll investigate it now. Please let me know about results

Oct 08, 2008, 1:09 PM
Sorry, should have precised it, but I tried both already, as I saw in the example that adding it as a field wasnt necessary, and the result is the same.
Btw, also forgot, but I'm deserializing to Linq entities).

Out of curiosity, how are we supposed to do in case of multiple ID's? ReaderID="Id1,Id2,etc..."?

Just tried with my AdministratorID as a field in the gridpanel, and it displays an empty string in both cases -_-
Will investigate why before making you lose more time :/

Oct 08, 2008, 1:15 PM
Something's weird here :/
Here the json from my proxy (regular handler) :

{totalCount:2,'Administrateurs':[{AdministrateurId:"4b71ef2f-4ad1-46da-90f4-9eca6f4b4fe5",NomAdministrateur:"Nom1",PrenomAdministrateur:"Prenom1",EmailAdministrateur:"email1@domain.com",CleMD5PwdAdministrateur:"43C32AEFEB5480D98E5DF2EEAD2A4297",CompteAdministrateurActif:true,IdUtilisateurCreat ion:"tempId",IdUtilisateurModification:"tempId",DateCreation:"2008-07-10T18:09:44",DateModification:"2008-08-01T15:22:49"},{AdministrateurId:"e259c066-115b-4289-a2b1-79e47e90dcac",NomAdministrateur:"Nom2",PrenomAdministrateur:"Prenom2",EmailAdministrateur:"email2@domain.com",CleMD5PwdAdministrateur:"43C32AEFEB5480D98E5DF2EEAD2A4297",CompteAdministrateurActif:true,IdUtilisateurCreat ion:"tempId",IdUtilisateurModification:"tempId",DateCreation:"2008-08-22T10:27:23",DateModification:"2008-09-01T15:51:20 ('email1@domain.com",CleMD5PwdAdministrateur:"43C32AEFEB5480D98E5DF2EEAD2A4297",CompteAdministrateurActif:true,IdUtilisateurCreat ion:"tempId",IdUtilisateurModification:"tempId",DateCreation:"2008-07-10T18:09:44",DateModification:"2008-08-01T15:22:49"},{AdministrateurId:"e259c066-115b-4289-a2b1-79e47e90dcac",NomAdministrateur:"Nom2",PrenomAdministrateur:"Prenom2",EmailAdministrateur:"email2@domain.com",CleMD5PwdAdministrateur:"43C32AEFEB5480D98E5DF2EEAD2A4297",CompteAdministrateurActif:true,IdUtilisateurCreat ion:"tempId",IdUtilisateurModification:"tempId",DateCreation:"2008-08-22T10:27:23",DateModification:"2008-09-01T15:51:20')"}]}

And here is my store and gridpanel.

<ext:Store runat="server" ID="Store1" AutoLoad="true" RemoteSort="true">
<ext:HttpProxy runat="server" Method="POST" Url="/Profils/WebControls/AdministrateursControler.ashx" />
<ext:HttpWriteProxy runat="server" Method="POST" Url="/Profils/WebControls/AdministrateurUpdater.ashx" />
<ext:JsonReader TotalProperty="totalCount" Root="Administrateurs" ReaderID="AdministrateurID">
<ext:RecordField Name="NomAdministrateur" />
<ext:RecordField Name="PrenomAdministrateur" />
<ext:RecordField Name="EmailAdministrateur" />
<ext:RecordField Name="CleMD5PwdAdministrateur" />
<ext:RecordField Name="CompteAdministrateurActif" />
<ext:RecordField Name="IdUtilisateurCreation" />
<ext:RecordField Name="IdUtilisateurModification" />
<ext:RecordField Name="DateCreation" />
<ext:RecordField Name="DateModification" />
<ext:Parameter Name="start" Value="0" Mode="Raw" />
<ext:Parameter Name="limit" Value="5" Mode="Raw" />
<SortInfo Field="NomAdministrateur" Direction="ASC" />
<LoadException Handler="Ext.MessageBox.alert('Erreur lors du chargement', response.statusText);" />
<ext:Panel ID="AdministrateursPanel" runat="server" Title="Gestion des administrateurs"
<ext:GridPanel runat="server" ID="GridPanel1" StoreID="Store1" Title="Administrateurs"
Header="false" Height="175" AutoExpandColumn="Administrateur">
<ColumnModel ID="ColumnModel1" runat="server">
<ext:RowNumbererColumn />
<ext:Column ColumnID="AdministrateurID" Header="Id" DataIndex="AdministrateurID"
<ext:Column ColumnID="Administrateur" Header="Nom complet" DataIndex="LastName" Sortable="true">
<Renderer Handler="return ''+record.data['NomAdministrateur']+','+record.data['PrenomAdministrateur']" />
<ext:Column ColumnID="EmailAdministrateur" Header="Email" DataIndex="EmailAdministrateur"
<ext:CheckColumn ColumnID="CompteAdministrateurActif" Header="Compte actif" DataIndex="CompteAdministrateurActif"
Sortable="false" />
<ext:Column ColumnID="Details" Header="Details" Width="50" Align="Center" Fixed="true"
MenuDisabled="true" Resizable="false">
<Renderer Fn="administrateurDetailsRender" />
<ext:Column ColumnID="Delete" Header="Supprimer" Width="50" Align="Center" Fixed="true"
MenuDisabled="true" Resizable="false">
<Renderer Fn="administrateurDeleteRender" />

Id's are correctly sent but seems to disappear somewhere :/
Am I setting them to an empty string somewhere?

Oct 08, 2008, 1:25 PM
If you need column with ID then need to add to fields

<ext:RecordField Name="AdministrateurID" />

Oct 08, 2008, 1:27 PM
Actually I removed it during the copy/paste as I thought it wasn't necessary, but I tried with and without AdministrateurID in the reader's fields, with the same behavior.

Oct 08, 2008, 1:37 PM
Can you create simple example, zip it and post? I'll try to investigate what happens

Oct 08, 2008, 1:51 PM
Ok I'll do that tomorrow.

Oct 09, 2008, 7:06 AM
Just sent it to Geoff, as I don't have your email adress.
Try to use the Edit window, and check what is sent to Updater handler.
Plz tell me if this is too messy.

Oct 09, 2008, 9:31 AM
Hi Rod,

Please be aware that reader fields are case-sensitive. The 'AdministrateurID' and 'AdministrateurId' are different names
Plus if you need to represent information in grid column then the record field must exists in Reader

<p class="MsoListParagraph" style="text-indent: -18pt;">

Oct 09, 2008, 9:36 AM
Perfectly working now, big thx Vlad :)
AdministratorID being in grid column was just cause I forgot to remove it while cleaning, but the pb was indeed AdministrateurID/Id case.