1. #1
    Ext User
    Join Date
    Mar 2010
    Posts
    21
    Vote Rating
    0
    crasho is on a distinguished road

      0  

    Question I Want to create JsonReader from Ext Designer, but i have troubles

    I Want to create JsonReader from Ext Designer, but i have troubles


    Hi.

    I'm working in a project, and i'm using ext designer. I have already the GUI, however i need load a combo with data from a database. I tried to create a Json Store, but i had troubles.

    Features of the project:

    - server="localhost"
    - path = var/www/uimqroo/alumnos/
    - main file= captura.php
    - ajax file= ajax_cbo_edo_civil_alumno.php
    - OS = Linux Ubuntu 9.10 64 bits
    - Extjs = 3.1

    After to create Json Store and push "Load Data", appear a error message from Ext Designer is "Unable to load data using supplied configuration", the code is:

    HTML Code:
    storeEstadosCiviles = Ext.extend(Ext.data.JsonStore, {
       constructor: function() {
          storeEstadosCiviles.superclass.constructor.call(this, {
             storeId: 'storeEstadosCiviles',
             idProperty: 'id_edo_civil',
             root: 'rows',
             url: 'ajax_cbo_edo_civil_alumno',
             autoLoad: true,
             fields : [
             {
                xtype: 'datafield',
                name: 'id_edo_civil',
                type: 'int',
                mapping: 'id_edo_civil'
             },
             {
                xtype: 'datafield',
                name: 'd_edo_civil',
                type: 'string',
                mapping: 'd_edo_civil'
             }
          ]
          });
       }
    });
    new storeEstadosCiviles();
    the php code of ajax file is:
    PHP Code:
    header("Content-Type: text/html; charset=iso-8859-1");
    header("Content-Encoding :iso-8859-1");

    $path dirname(__FILE__);
    require_once(
    "$path/../libs/adodb/adodb-exceptions.inc.php");
    require_once(
    "$path/../libs/adodb/adodb.inc.php");
    require_once(
    "$path/../includes/utf8.php")    ;
    require_once(
    "$path/../includes/config.php");
    require_once(
    "$path/../includes/conexion.php");

    //Conexión a la base de datos
    $db=Conectar();


    $qryBuscarEdosCiviles="select id_edo_civil,d_edo_civil
                           from dbuimqroo.uimqroo_cat_edo_civil"
    ;

    $tt $db->GetOne("SELECT COUNT(*) FROM dbuimqroo.uimqroo_cat_edo_civil");
    $rs $db->SelectLimit($qryBuscarEdosCiviles,1000,0);
    $rows $rs->GetAll();
    $rs->Close();

    $response = array("success" => true"total" => $tt "rows"=> $rows);
    echo 
    json_encode(utf8_encode_array($response)); 
    The output file is:
    {"success":true,"total":"2","rows":[{"id_edo_civil":"1","d_edo_civil":"SOLTERO"},{"id_edo_civil":"2","d_edo_civil":"CASADO"}]}


    In Edit->Preferences i have this:

    URL PREFIX: http://localhost
    Ext Direct API:
    Export Path :
    Ext js Path : ../../ext3/
    Spaces to indent: 3


    Why the error? anybody have a example or tutorial for to do this?

    Thanks a lot

  2. #2
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    8,883
    Vote Rating
    102
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default


    Put a / at the end of your localhost in your url prefix.

    Does putting the following url in your browser return your json?
    http://localhost/ajax_cbo_edo_civil_alumno
    Aaron Conran
    @aconran
    Sencha Architect Development Team

  3. #3
    Ext User
    Join Date
    Mar 2010
    Posts
    21
    Vote Rating
    0
    crasho is on a distinguished road

      0  

    Default


    Hi Anconran.

    1.- I put a /
    2.- No, i don't, mi site is in localhost/uimqroo/alumnos/ if i put localhost/uimqroo/alumnos/ajax_cbo_edo_civil_alumno.php i receive the JSON.

    thanks

  4. #4
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    8,883
    Vote Rating
    102
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default


    Change either the prefix or the url so that it generates a url that will get the JSON.

    You could use the url Prefix of "http://localhost/uimqroo/alumnos/" and your current url.
    Aaron Conran
    @aconran
    Sencha Architect Development Team

  5. #5
    Ext User
    Join Date
    Mar 2010
    Posts
    21
    Vote Rating
    0
    crasho is on a distinguished road

      0  

    Default


    Hi

    i did this:

    in URL Prefix put http://localhost/uimqroo/alumnos and on Property URL i left ajax_cbo_edo_civil_alumno.php, but, don't work, i receive the same error message.




  6. #6
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    8,883
    Vote Rating
    102
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default


    Does the url prefix have the ending /?
    Aaron Conran
    @aconran
    Sencha Architect Development Team

  7. #7
    Ext User
    Join Date
    Mar 2010
    Posts
    21
    Vote Rating
    0
    crasho is on a distinguished road

      0  

    Default


    Yes, it does, sorry i forgot to put it.

    is: http://localhost/uimqroo/alumnos/

    But, the same error



  8. #8
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    8,883
    Vote Rating
    102
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default


    Is the code in the first post accurate? Should there be a .php extension at the end of the store?
    Aaron Conran
    @aconran
    Sencha Architect Development Team

  9. #9
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    8,883
    Vote Rating
    102
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default


    We have this as open item internally to improve the workflow with data store. Show the data, etc
    Aaron Conran
    @aconran
    Sencha Architect Development Team

  10. #10
    Ext User
    Join Date
    Mar 2010
    Posts
    21
    Vote Rating
    0
    crasho is on a distinguished road

      0  

    Default


    Hi again

    I put the code again:

    HTML Code:
    storeEstadosCiviles = Ext.extend(Ext.data.JsonStore, {
       constructor: function() {
          storeEstadosCiviles.superclass.constructor.call(this, {
             storeId: 'storeEstadosCiviles',
             idProperty: 'id_edo_civil',
             root: 'rows',
             url: 'ajax_cbo_edo_civil_alumno.php',
             autoLoad: true,
             fields : [
             {
                xtype: 'datafield',
                name: 'id_edo_civil',
                type: 'int',
                mapping: 'id_edo_civil'
             },
             {
                xtype: 'datafield',
                name: 'd_edo_civil',
                type: 'string',
                mapping: 'd_edo_civil'
             }
          ]
          });
       }
    });
    new storeEstadosCiviles();
    I did all, directly using netbeans and work the ajax, but, i want to do from ext designer.

Thread Participants: 1

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar