Home arrow JavaScript arrow Page 2 - EXT JS Passing Live Data
JAVASCRIPT

EXT JS Passing Live Data


Welcome to part two of the EXT-JS live data tutorial. In part one we created the underlying page and added the code to create the JsonStore, ColumnModel and GridPanel. Our GridPanel, however, currently has no data, so the first thing were going to do in this part of the tutorial is add the PHP code that will pass this data back to the JsonStore.

Author Info:
By: Dan Wellman
Rating: 4 stars4 stars4 stars4 stars4 stars / 12
July 27, 2009
TABLE OF CONTENTS:
  1. · EXT JS Passing Live Data
  2. · MySQL
  3. · Adding Additional Configuration Properties
  4. · Working More Closely with the Back End

print this article
SEARCH DEVARTICLES

EXT JS Passing Live Data - MySQL
(Page 2 of 4 )

Your database and the example table will already need to be set up with the correct fields and data types. The following commands at the MySQL Command Line Interface (CLI) can be used to achieve this:


CREATE DATABASE shop;


USE shop;


CREATE TABLE products (title VARCHAR(40), image VARCHAR(40), inStock ENUM(y, n), price DECIMAL(5,2), category VARCHAR(20), manufacturer VARCHAR(20));


Each command should go on its own line, and the enter key should be pressed after each line. We define each of the fields in the table, mostly using standard characters of differing lengths (VARCHAR). We also define the inStock field using ENUM, which is synonymous for a Boolean value, and the DECIMAL type, which gives more accurate financial rounding. With this type we specify the total number of figures with the first integer and the number of decimal places with the second.

Unless you happen to have a table stuffed full of product information, youre going to need to add the data used in this example to your database. You could do this manually, but as were using approximately 40 products for this example, that could take some time. Ive created a text file which can be used to add the required data to the database automatically, which should be included with the code download for this tutorial. All you need to do to use this file is run the following command in the MySQL CLI:


LOAD DATA LOCAL INFILE 'c:/pathTo/stockList.txt' INTO TABLE products LINES TERMINATED BY '\r\n';


Now that we have the data in our database and have the PHP file ready to pass the data back to our JsonStore, the GridPanel should be populated when the page is opened, as in the following screen shot:




blog comments powered by Disqus
JAVASCRIPT ARTICLES

- Project Nashorn to Make Java, JavaScript Wor...
- JavaScript Virus Attacks Tumblr Blogs
- Google Releases Stable Dart Version, JavaScr...
- Khan Academy Unveils New JavaScript Learning...
- Accessing Nitro? There`s an App for That
- JQuery 2.0 Leaving Older IE Versions Behind
- Fastest JavaScript Engine Might Surprise You
- Microsoft Adjusting Chakra for IE 10
- Brendan Eich: We Don`t Need Google Native Cl...
- An Overview of JavaScript Statements
- An Overview of JavaScript Operators
- Overview of JavaScript Variables
- More of the Top jQuery Social Plugins
- The Top jQuery Social Plugins
- More of the Top jQuery Slider Plugins

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 

Developer Shed Affiliates

 




© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials