CodeIgniter and ExtJS issue

#1
[eluser]Unknown[/eluser]
Hi,

I am trying to pass entries drom db.table using json_encode() to am ExtJS grid:

Code:
$clienti = array();
        
        foreach ($query->result_array() as $row)
        {
               $clienti[] = $row;
        }
        echo json_encode(array('clienti' => $clienti));

        $this->load->view('view');

Using firebug i get the fallowing error when loading the view:
http://localhost/softprofile/index.php/main?_dc=1254578827887 404 not found

My data store for the grid looks like this:
Code:
var dataStore = new Ext.data.JsonStore({

          url:'main',

          root:'clienti',

          fields:['id', 'denumire', 'CUI', 'adresa']
        });

I am new to codeigniter and extjs. What i am doing wrong.

Help me out please!
Thanks!

#2
[eluser]oldroy[/eluser]
If firebug is telling you it can't find the page work on this first.....

The url in your datastore says 'main'.....put in a full url first just to find your page. Your json isn't written in an ext friendly way - we'll look at that once you get firebug to say you got to the page you are looking for.

When you get the error page back from a post with the _dc you'll usually need to you a dataproxy. Try changing your url first and see if you at least get a response back.

I'm assuming that the controller you are trying to get to and have data returned from already works as you plan....

#3
[eluser]Unknown[/eluser]
I have enabled $config['enable_query_strings'] and used the data store like this:
var dataStore = new Ext.data.JsonStore({

url:'$nroot/index.php?c=main&m=main_model',

root:'clienti',

fields:['id', 'denumire', 'CUI', 'adresa'],

remoteSort:true

});
and i still get next error:
http://localhost/softprofile/index.php?c=main&m=main_model&_dc=1254744756560 404 not found

#4
[eluser]oldroy[/eluser]
Can you get to the url from the address bar in the browser window? Or can you load the result of your controller function into a plain view first?

Make sure that you can find it using codeigniter first. If you can, then it's time to use a dataproxy with the datastore.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.