1. #1
    Ext User
    Join Date
    Jul 2010
    Location
    New York
    Posts
    11
    Vote Rating
    0
    mcamer is on a distinguished road

      0  

    Default ExtJS JsonWriter undefined parameters

    ExtJS JsonWriter undefined parameters


    So I'm a newbie for ExtJS and trying to do some integration with microsoft's OData services.

    I basically extended a JsonReader that would read the "oddly formatted" JSON that the OData service is returning, I'm creating records in the reader and returning it in readRecords().... By doing that, I was able to see the data coming from the service in my Grid, so far so good!

    Now the writing back was a bit of an issue, I assumed that by putting in a JsonWriter to the store, that it will magically compose the JSON string as a post action to the service. But for some reason I was checking the post parameters via firebug, and it was something like this

    undefined {}

    The URL is exactly what I defined, so it's acting as expected, but it's not gathering the values and composing the JSON parameters!

    The JSON Writer I defined is as follow

    Code:
    var writer = new Ext.data.JsonWriter({
                encode: true,
                writeAllFields: false
            });
    I guess my question would be, would it be possible I screwed up something with extending the JsonReader? Or are they not related? And what would cause such a behavior?

    If my question is too vague, I would love to debug this myself, but I guess I would like to know where to start from? What would be the function that composes the parameters for JSON Requests in the JsonWriter?

    Thank you in advance!


    -----
    I was actually just debugging this, and I noticed that during the Ajax request composing, it's treating the update as a creation! I found out that for some reason the records phantom property is set to true, therefore it's trying to make a create request rather than an update one. Does that ring a bell?

  2. #2
    Ext JS Premium Member
    Join Date
    Oct 2009
    Location
    Melrose, MA
    Posts
    48
    Vote Rating
    3
    hjones is on a distinguished road

      0  

    Default


    Make sure you have the idProperty config property on your reader/store.
    If you don't sent this up then the record will auto assign an id and set phantom = true.
    Here's a comment from Ext.data.Record.js...

    Any record which has a real database pk set as its id property
    * is NOT a phantom -- it's real.

    Also, if you are using the mapping config property in the field definition then idProperty should be pointing to that...in my case 'ID' instead of the default 'id'.

    I struggled with this for an hour or two this afternoon before figuring it all out.

    Quote Originally Posted by mcamer View Post
    So I'm a newbie for ExtJS and trying to do some integration with microsoft's OData services.

    I basically extended a JsonReader that would read the "oddly formatted" JSON that the OData service is returning, I'm creating records in the reader and returning it in readRecords().... By doing that, I was able to see the data coming from the service in my Grid, so far so good!

    Now the writing back was a bit of an issue, I assumed that by putting in a JsonWriter to the store, that it will magically compose the JSON string as a post action to the service. But for some reason I was checking the post parameters via firebug, and it was something like this

    undefined {}

    The URL is exactly what I defined, so it's acting as expected, but it's not gathering the values and composing the JSON parameters!

    The JSON Writer I defined is as follow

    Code:
    var writer = new Ext.data.JsonWriter({
                encode: true,
                writeAllFields: false
            });
    I guess my question would be, would it be possible I screwed up something with extending the JsonReader? Or are they not related? And what would cause such a behavior?

    If my question is too vague, I would love to debug this myself, but I guess I would like to know where to start from? What would be the function that composes the parameters for JSON Requests in the JsonWriter?

    Thank you in advance!


    -----
    I was actually just debugging this, and I noticed that during the Ajax request composing, it's treating the update as a creation! I found out that for some reason the records phantom property is set to true, therefore it's trying to make a create request rather than an update one. Does that ring a bell?

Similar Threads

  1. I want to pass parameters with HttpProxy in Extjs 2.0
    By httpftp21 in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 23 Jun 2010, 11:31 PM
  2. [3.1] DirectProxy/DirectFn parameters are undefined.
    By Sesshomurai in forum Ext.Direct
    Replies: 1
    Last Post: 3 Feb 2010, 9:22 AM
  3. [Closed] JsonWriter and UNDEFINED parameter
    By chesstrix in forum Ext 3.x: Help & Discussion
    Replies: 10
    Last Post: 5 Aug 2009, 2:40 PM
  4. Replies: 22
    Last Post: 10 Jul 2009, 2:08 PM

Thread Participants: 1

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..."