[CLOSED] problems loading Store similar to how coolite does for static data

Page 1 of 2 12 LastLast
  1. #1

    [CLOSED] problems loading Store similar to how coolite does for static data

    I'm trying to simulate the coolite store that is created and am having troubles. I keep getting an "object not found" on the store creation. The offending code is below, and I've also attached my example code that is a complete failing stand alone html file (js with tags).
    
    
    
    var sessionData = [
    
    
    {
    
    
    Username : 'Crockford',
    
    
    "Title": " The Good Parts (Part 1)",
    
    
    "Description": "JavaScript is a language with more than its share of bad parts. It went from non-existence to global adoption in an alarmingly short period of time. It never had an interval in the lab when it could be tried out and polished. JavaScript has some extraordinarily good parts. In JavaScript there is a beautiful, highly expressive language that is buried under a steaming pile of good intentions and blunders. The best nature of JavaScript was so effectively hidden that for many years the prevailing opinion of JavaScript was that it was an unsightly, incompetent abomination. My intention here is to expose the goodness in JavaScript, an outstanding dynamic programming language. Within the language is an elegant subset that is vastly superior to the language as a whole, being more reliable, readable, and maintainable.\r\n\r\nThis will be presented in two timeslots.",
    
    
    "Createdate": "2008-06-23T09:19:50",
    
    
    "Id": 12
    
    
    },
    
    
    {
    
    
    Username: "pkellner",
    
    
    Title: "Building High performance ASP.NET web applications",
    
    
    Description: "<p>Topics will include appropriate use of Cache and Session State, as well as how and when to use them. Viewstate management and methods to minimize its use will be discussed. Code to pop up a warning when a threshold is met in development will be shown. When and how to take advantage of Server Farms will be discussed, as well as trouble shooting techniques to find problems. The evils of Server Affinity, as well as a common pattern for caching database queries will be shown to be wrong. Time permitting, we will talk about using Microsoft?s Ajax.asp.net with UpdatePanel and webservices and how these affect performance and scalability.</p>\r\n",
    
    
    Createdate: "2008-06-19T20:10:36",
    
    
    "Id": 2
    
    
    },
    
    
    ];
    
    
     
    
    
    this.Store1 = new Ext.Store({
    
    
    id: "Store1",
    
    
    reader: new Ext.data.JsonReader({
    
    
    fields: [{
    
    
    name: "Title"
    
    
    },
    
    
    {
    
    
    name: "Username"
    
    
    },
    
    
    {
    
    
    name: "Description"
    
    
    },
    
    
    {
    
    
    name: "Createdate"
    
    
    }],
    
    
    id: "Id"
    
    
    }),
    
    
    autoLoad: false
    
    
    });
    
    
    Store1.proxy = new Ext.data.PagingMemoryProxy(sessionData, false);
  2. #2

    RE: [CLOSED] problems loading Store similar to how coolite does for static data

    Hi Piter,

    The Ext.data.PagingMemoryProxy is non ExtJS standart class. Stamdarts ExtJS js files don't include this class. This class placed in separated file. If you have ExtJS distributive then you can find it in

    ext-2.2\examples\locale\PagingMemoryProxy.js

    Please note that Ext.data.PagingMemoryProxy which was included to the Coolite Toolkit is differ than standart PagingMemoryProxy (there are few changes).

    The coolite version of file you can find in Coolite distributive

    Coolite.Ext.Web\Build\Resources\Coolite\coolite\co olite-data.js

    Hope this help


  3. #3

    RE: [CLOSED] problems loading Store similar to how coolite does for static data

    Thanks,

    Now I don't get the error, but my data is not getting loaded. I've included in the below code what I have updated my code to. (I also used the coolite store. I assume that is necessary?)

    
    
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    
    
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    
    
    <head>
    
    
    <title></title>
    
    
    <link href="../js/ext-all.css" rel="stylesheet" type="text/css"/>
    
    
    <script src="../js/ext-base.js" type="text/javascript"></script>
    
    
    <script src="../js/ext-all-debug.js" type="text/javascript"></script>
    
    
    <script src="../js/coolite-data.js" type="text/javascript"></script>
    
    
    <script type="text/javascript">
    
    
    /// <reference path="../js/ext-base.js" />
    
    
    /// <reference path="../js/ext-all-debug.js" />
    
    
     
    
    
    Ext.onReady(function() {
    
    
    Ext.QuickTips.init();
    
    
    ctl00_blankContent_Store1_Data = [
    
    
    {
    
    
    Username : 'Crockford',
    
    
    "Title": " The Good Parts (Part 1)",
    
    
    "Description": "JavaScript is a language with more than its share of bad parts. It went from non-existence to global adoption in an alarmingly short period of time. It never had an interval in the lab when it could be tried out and polished. JavaScript has some extraordinarily good parts. In JavaScript there is a beautiful, highly expressive language that is buried under a steaming pile of good intentions and blunders. The best nature of JavaScript was so effectively hidden that for many years the prevailing opinion of JavaScript was that it was an unsightly, incompetent abomination. My intention here is to expose the goodness in JavaScript, an outstanding dynamic programming language. Within the language is an elegant subset that is vastly superior to the language as a whole, being more reliable, readable, and maintainable.\r\n\r\nThis will be presented in two timeslots.",
    
    
    "Createdate": "2008-06-23T09:19:50",
    
    
    "Id": 12
    
    
    },
    
    
    {
    
    
    Username: "pkellner",
    
    
    Title: "Building High performance ASP.NET web applications",
    
    
    Description: "&amp;lt;p&amp;gt;Topics will include appropriate use of Cache and Session State, as well as how and when to use them. Viewstate management and methods to minimize its use will be discussed. Code to pop up a warning when a threshold is met in development will be shown. When and how to take advantage of Server Farms will be discussed, as well as trouble shooting techniques to find problems. The evils of Server Affinity, as well as a common pattern for caching database queries will be shown to be wrong. Time permitting, we will talk about using Microsoft?s Ajax.asp.net with UpdatePanel and webservices and how these affect performance and scalability.&amp;lt;/p&amp;gt;\r\n",
    
    
    Createdate: "2008-06-19T20:10:36",
    
    
    "Id": 2
    
    
    },
    
    
    ];
    
    
     
    
    
    this.ctl00_blankContent_Store1 = new Coolite.Ext.Store({
    
    
    id: "ctl00_blankContent_Store1",
    
    
    ajaxEventConfig: {
    
    
    formProxyArg: "aspnetForm"
    
    
    },
    
    
    reader: new Ext.data.JsonReader({
    
    
    fields: [{
    
    
    name: "Title"
    
    
    },
    
    
    {
    
    
    name: "Username"
    
    
    },
    
    
    {
    
    
    name: "Description"
    
    
    },
    
    
    {
    
    
    name: "Createdate"
    
    
    }],
    
    
    id: "Id"
    
    
    }),
    
    
    autoLoad: true
    
    
    });
    
    
    ctl00_blankContent_Store1.proxy = new Ext.data.PagingMemoryProxy(ctl00_blankContent_Store1_Data, false);
    
    
    var grid = new Ext.grid.GridPanel({
    
    
    height: 500,
    
    
    renderTo: 'grid-example',
    
    
    title: 'Sessions',
    
    
    store: 'ctl00_blankContent_Store1',
    
    
    columns: [{
    
    
    dataIndex: 'Title',
    
    
    header: 'Title'
    
    
    },{
    
    
    dataIndex: 'Username',
    
    
    header: 'username'
    
    
    },{
    
    
    dataIndex: 'Createdate',
    
    
    header: 'Creation Date',
    
    
    renderer: Ext.util.Format.dateRenderer('m/d/Y')
    
    
    }],
    
    
    viewConfig: {
    
    
    forceFit: true
    
    
    }
    
    
    });
    
    
     
    
    
    });
    
    
     
    
    
    </script>
    
    
    </head>
    
    
    <body>
    
    
     
    
    
    <div id="grid-example">
    
    
    
     
    
    
    <div id='top1'>
    
    
    ABCDE
    
    
    <hr/>
    
    
    <div id='div1'>
    
    
    
    
    
    
    
    
    
    
    </body>
    
    
    </html>
  4. #4

    RE: [CLOSED] problems loading Store similar to how coolite does for static data

    Hi,

    The GridPanel store property requires store object but you set a string. Try remove quotes

       change  - store: 'ctl00_blankContent_Store1'
       by - store: ctl00_blankContent_Store1,

  5. #5

    RE: [CLOSED] problems loading Store similar to how coolite does for static data

    still, after unquoting the store, I get no data. :(
  6. #6

    RE: [CLOSED] problems loading Store similar to how coolite does for static data

    Hi Piter,

    I found only one problem - trailing comma in your Data array (IE hates trailing comma and brokes).
    After removing this comma your example works without errors and data displayed.

    Change
    
    "Id": 2
    },
    By
    
    "Id": 2
    }

  7. #7

    RE: [CLOSED] problems loading Store similar to how coolite does for static data

    One useful tool which you can use for check your javascript code

    http://jslint.com/

    Hope this help.

    Let me know if the example still doesn't work


  8. #8

    RE: [CLOSED] problems loading Store similar to how coolite does for static data

    Thanks Vladimir,

    This worked for me! My bad. It was a cut and paste error on my part. I will definitely start using jslint. Thanks for the tip.

  9. #9

    RE: [CLOSED] problems loading Store similar to how coolite does for static data

    Hillarious.

    The answer was looking right at you the whole time...

    Username : 'Crockford',
    "Title": " The Good Parts (Part 1)",
    Douglas Crockford is also the author/proprietor of http://www.jslint.com/

    Geoffrey McGill
    Founder
  10. #10

    RE: [CLOSED] problems loading Store similar to how coolite does for static data



    I didn't know that. He's spoken at our last 3 code camps. He works at Yahoo and has been a huge help to making the event successful. Our all volunteer event was just last week and he had about 250 people in his sessions. He likes to grab the first two sessions Saturday morning and does not stop for a rest in the middle.

    It was not, until very recently, been at all interested in JavaScript. Now I see how big a person he is in the JS community. Next year, I'll have to bring him water. :)
Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 4
    Last Post: Jan 12, 2012, 11:47 AM
  2. [CLOSED] Loading data in store take too long. browser hangs.
    By speedstepmem3 in forum 1.x Legacy Premium Help
    Replies: 21
    Last Post: Nov 22, 2011, 8:42 AM
  3. [CLOSED] Loading data from server to store by javascript
    By leon_tang in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Apr 21, 2011, 4:44 PM
  4. [CLOSED] Json Problems when loading lot of data
    By FpNetWorth in forum 1.x Legacy Premium Help
    Replies: 11
    Last Post: Mar 22, 2011, 5:05 PM
  5. Replies: 7
    Last Post: Dec 18, 2008, 12:09 AM

Posting Permissions