Results 1 to 4 of 4

Thread: How do I define a JsonWriter for a JsonStore that was created by the Designer?

  1. #1
    Ext User
    Join Date
    Aug 2010
    Posts
    12
    Vote Rating
    0
      0  

    Default How do I define a JsonWriter for a JsonStore that was created by the Designer?

    Hello!
    I created a EditorGridPanel and attached a JsonStore to it. All loads fine. But when I edit cells it doesn't try to write anything back to the server.
    Do I need to define and attach a JsonWriter to the store? Like what's described here?

    However, the JsonStore definition that was created and exported by the Designer is confusing to me (I'm new to Ext). The definition looks like this:
    Code:
    MyStore = Ext.extend(Ext.data.JsonStore, {
        constructor: function(cfg) {
            cfg = cfg || {};
            MyStore.superclass.constructor.call(this, Ext.apply({
                storeId: 'MyStore',
                url: 'http://localhost:8001/resource/AllCustomer/entries',
                fields: [
                    {
                        name: 'ID'
    ...
    and so on.

    Where/how do I go about adding a JsonWriter to this?

    Thank you very much...

    Juergen

  2. #2
    Sencha Premium User wemerson.januario's Avatar
    Join Date
    Nov 2008
    Location
    Goiânia - GO, Brazil
    Posts
    763
    Vote Rating
    64
      0  

    Default

    this version of Ext Designer does not support Writer yet.
    So you have to add manuallyt.
    Eg:
    you create a global var , just to not add everytime.
    Code:
    var w = new Ext.data.JsonWriter({
        encode: true,
        writeAllFields: false
    });
    And Then add the writer when you instanciate the store.
    Code:
    myStore= new Mystore({
                writer: w
            });
    And you can add the store to the grid.
    mygrid.store = myStore;
    Wemerson Januario
    Blog: http://wemersonjanuario.com.br
    Contrate-me/Hire me on: https://www.upwork.com/fl/wemersonjanuario
    From: Goiânia, GO, Brazil
    Sencha Consultant and Web Developer

    Treinamento e Consultoria Ext JS. QUALIFIQUE-SE JÁ!

    modern toolkit locale package - https://github.com/wemersonjanuario/modern-locale

  3. #3
    Ext User
    Join Date
    Aug 2010
    Posts
    12
    Vote Rating
    0
      0  

    Default

    Hello!

    Thank you for your response. Yes, I had done that much already. However, the problem I had encountered (and which still persists) is that adding a writer this way changes the behavior of the JsonStore. Suddenly, it uses a POST request ("xaction=read") to retrieve data, when I really would want it to continue using GET as it did before I added the writer.

    Would you happen to know how to fix the JsonStore so that it doesn't change its behavior when reading data?

    I also created a separate thread for this here.

    Thank you very much...

    Juergen

  4. #4
    Sencha Premium User wemerson.januario's Avatar
    Join Date
    Nov 2008
    Location
    Goiânia - GO, Brazil
    Posts
    763
    Vote Rating
    64
      0  

    Default use api

    When you are using writing in stores. it sends 4 actions.
    create, update, read and destry. To avoide it send as xactions, You can use the api like.

    in Store set api config like this
    Code:
    api: {
    read: "mydir/read.php",
    create: "mydir/save.php,
    update: "mydir/save.php",
    destroy: "mydir/delete.php"
    }
    Wemerson Januario
    Blog: http://wemersonjanuario.com.br
    Contrate-me/Hire me on: https://www.upwork.com/fl/wemersonjanuario
    From: Goiânia, GO, Brazil
    Sencha Consultant and Web Developer

    Treinamento e Consultoria Ext JS. QUALIFIQUE-SE JÁ!

    modern toolkit locale package - https://github.com/wemersonjanuario/modern-locale

Similar Threads

  1. Ext Designer Problem: How to define number of columns in column layout?
    By romanczar in forum Ext Designer: Help & Discussion
    Replies: 4
    Last Post: 30 Sep 2010, 8:00 AM
  2. Setting Reader for JsonStore when using Designer
    By ampeer in forum Ext Designer: Help & Discussion
    Replies: 1
    Last Post: 20 Jul 2010, 10:05 AM
  3. JsonStore with JsonWriter, how to do it correctly
    By Sgt.Pepper in forum Ext 3.x: Help & Discussion
    Replies: 1
    Last Post: 21 Apr 2010, 6:53 PM
  4. Replies: 3
    Last Post: 3 Sep 2009, 10:04 PM
  5. Replies: 8
    Last Post: 29 Jul 2009, 11:35 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •