Results 1 to 6 of 6

Thread: Callback problems using Codeigniter and ScriptTagProxy

  1. #1
    Sencha - Support Team
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,410

    Default Callback problems using Codeigniter and ScriptTagProxy

    I am trying to get my grid to load data using ScriptTagProxy. I am able to see the JSON records in FB:Net:HTML:Response.

    Under Params I see stcCallback1001. The GET is displaying the param as:

    Code:
    http://10.0.0.100/bms-hr/index.php/users/list_users/?_dc=1284415387926&callback=stcCallback1001
    store info:

    Code:
    var remoteProxy = new Ext.data.ScriptTagProxy({
      api: {
        read : 'index.php/users/list_users/',
        create : 'index.php/users/insert_users/',
        update: 'index.php/users/update_users/',
        destroy: 'index.php/users/delete_users/'
      }
    });
    
    var dataStore = new Ext.data.JsonStore({
      proxy: remoteProxy,
      root: 'users',
      autoLoad: true,
      autoSave: false,
      successProperty : 'success',
      totalProperty : 'totalCount',
      messageProperty: 'message',
      idProperty: 'id_user',
      writer: writer,
      fields: userFields
    });
    CI:Controller: users.php

    Code:
     function list_users() {
        $data = json_encode($this->User_model->list_users());
        $cb = isset($_GET['callback']) ? $_GET['callback'] : '';
        print $cb . '(' . $data . ')';
      }
    $_GET['callback'] is not returning a value from my controller file.

    Is CI causing this, or my code?

    Regards,
    Scott.

  2. #2
    Sencha - Support Team
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,410

    Default

    FYI,
    Seems CI disables _GETS. I used _REQUEST and all is well.

    Regards,
    Scott.

  3. #3
    Sencha User
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,890

    Default

    But why are you using a ScriptTagProxy? I see relative URLs there which will go to the page's origin domain.

  4. #4
    Sencha - Support Team
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,410

    Default

    Animal,

    I 'thought' I read in the forums this was the preferred method in my approach. Could I get you to explain in more detail on why this not correct? Should I be using httpProxy?

    I am still trying to decipher ExtJS as I go. (even after numerous rtfm sessions)

    Thanks for the help!

    Regards,
    Scott.

  5. #5
    Sencha User
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,890

    Default

    Well it uses a <script> element to communicate. Which is why you are forced to pass the data into a callback: The result must be executable Javascript.

    if you used an HttpProxy, you just return JSON.

  6. #6
    Sencha - Support Team
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,410

    Default

    Animal,

    Thanks for the tip. For anyone watching:

    Code:
    var proxy = new Ext.data.HttpProxy({
      method: 'POST',
      url : 'index.php/employees/list_employees/'
    });
    This also follows CI in not using GET approach.

    Regards,
    Scottl

Similar Threads

  1. ScriptTagProxy, callback is not defined
    By Thief59 in forum Ext GWT: Discussion
    Replies: 7
    Last Post: 13 Oct 2010, 6:45 AM
  2. Any way to have some callback function using scripttagproxy
    By shown_james in forum Ext 3.x: Help & Discussion
    Replies: 1
    Last Post: 23 Aug 2010, 3:12 AM
  3. Replies: 6
    Last Post: 16 Jan 2009, 11:23 AM
  4. Problems with ScriptTagProxy
    By fzammetti in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 19 Dec 2008, 7:28 PM
  5. ScriptTagProxy callback function unwanted?
    By shortestpath in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 27 Feb 2008, 9:33 AM

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
  •