View Full Version : grids and php

27 Sep 2010, 8:25 AM
I am new to ext and am trying to figure out how to properly use data with grids

I have the following code thus far:

function js_listSales ()
$salesList = $this->user_home_model->getsales();

foreach ($salesList->result() as $row)
$item = Array("Month" => $row->budget_month,
"Forecast" => $row->budget_forecast_amount,
"Actual" => $row->budget_actual_amount);
$itemList[] = $item;

$rows = $salesList->num_rows();
$data = json_encode($itemList);

echo '({"total":"' . $rows . '","results":' . $data . '})';

Which results in:

However, when i point ext designer to that url is says:

"unable to load data using the supplied configuration"

You guys have a really awesome product by the way, trying to figure it out so I can leverage it.

28 Sep 2010, 4:57 AM
Hi eroberts,

I am assuming you supplied a url to the JsonStore, and a "root" property of "results"? Also, try removing the surrounding parenthesis.

Let me know if that helps.

28 Sep 2010, 8:43 AM
So i thought maybe my php was jacked up, but I manually programmed an ext grid with the same json code and i worked.

Something I may be missing, should the data pop up in ext_designer? Is there something I am missing?

Here is my project file and the way I got it work manually. I added the db in case you wanted to try to make it work.

Thanks for your quick response.

28 Sep 2010, 7:18 PM
Hey eroberts,

You have the "root" set to "results" instead of "rows" and you didn't supply "results" as the "totalProperty". If you just change your configuration slightly in the Designer it will work for you.


7 Oct 2010, 6:49 PM
thanks for the help, but it is still not working. I can not load the JSON store in designer to see the data working.

Are there any books? I missed to webinar will it be posted?

Would it be better to start from the ground up with EXT than to start with the designer, cause I feel I have no grasp of ext causing me to not understand the designer portion.

8 Oct 2010, 5:25 AM
Hey eroberts,

Go ahead and attach your latest stuff one more time, and I can edit it for you to get it working and give an explanation of what needed to be done. For getting your Ext JS front end to work in harmony with your back end, does require a certain level of knowledge about the Ext JS data package. Most everything you need to know is in our documentation and well covered in the examples that are packaged with the framework (http://dev.sencha.com/deploy/dev/examples/).

You can check out the Learning Center, which has information on Ext JS and Ext Designer: http://www.sencha.com/learn/index.php?title=Main_Page

The webinar will be posted as a video. I will put a posting here on the forums, as well as tweet it, @jarrednicholls. I'm also going to create some additional screencasts that break down the webinar into smaller & more manageable sections that are easier to digest.

8 Oct 2010, 7:23 AM
The code is the same as previously posted. I changed the root and total property that is all I have changed. I pulled the JSON from my php function and inserted in to the data property and the store loaded, so I know the JSON is good, I know the url is producing JSON.


I do appreciate your help, if you want me to post my project again let me know. thanks for the links.

What I was going for with designer was to lower my learning curve a bit for this library. It is working this is just puzzled me though.

thanks again.


8 Oct 2010, 7:36 AM
Hmm. Everything appears to be correct. If you right-click on the store and click "Load Data", does it say "N records loaded"? Or does it give an error?

The only other thing I see wrong in the original project.xds that was posted, is that "MyStore" has a storeId of "MyStore", yet neither of your two GridPanel's are setup to use a store "MyStore"...I see "salesGrid" and "servicesGrid". Did you bind your store to the grids?

8 Oct 2010, 8:24 AM

I attached the error message that it is giving me. I did have them mapped to those store previously, but have since deleted them. The stores should load regardless of any of the UI that they might be attached to correct?

I'll keep trying maybe I'll learn something in the process.

8 Oct 2010, 9:08 AM
OK, So I made a standard php db call and it worked, I made the same call using codeigniter library, doesn't work. Returns the same data, but won't populate in ext designer. any thoughts?

I accessed the file that worked through localhost/test.php
then through mvc at localhost/ci/index.php/test

could mvc be giving it problems or codeigniter? this is weird.

8 Oct 2010, 11:42 AM
Are you positive the data returned is exactly the same? I just don't see the friendly URL pathing of ci having any affect, but the response from the server would. It needs to be HTTP OK (200) and pure JSON text. Does the system have some sort of authentication mechanism, and your browser is simply logged in while the Designer obviously wouldn't be? I'm sort of at a loss without seeing all of the details first hand.