Results 1 to 2 of 2

Thread: Why JsonStore don't display date?

  1. #1

    Default

    I use JsonStore to display some data,like follows:
    Code:
    Ext.onReady(function(){
     Ext.QuickTips.init();
     var header=new Ext.Panel({
      height:70,
      region:'north'
     });
     var cols=[
      {header:'contractNo',width:160},
      {header:'value',width:160},
      {header:'company',width:160}
     ];
     var center=new Ext.Panel({
      width:200,
      region:'center',
      columns:cols,
      store:mystore,
      stripeRows:true 
     });
     new Ext.Viewport({
      layout:'border',
      items:[header,center]
     });
     var mystore=new Ext.data.JsonStore({
      fields:['contractNo','value','company']
     });
     var data=[{
      'contractNo':'a100001','value':'100','company':'HP'
     }];
     mystore.loadData(data);
    });
    When I run above code,I can't see any record,where is wrong? How to correct it?
    Thanks

  2. #2
    Ext JS Premium Member dj's Avatar
    Join Date
    Mar 2007
    Location
    Germany
    Posts
    573

    Default

    (a) Ext.Panel has no store property. You probably meant to create an Ext.grid.GridPanel
    (b) Your creation order is wrong. You have to first create the store to be able to pass it along as a config option.

    Code:
    Ext.onReady(function(){
     Ext.QuickTips.init();
     var mystore=new Ext.data.JsonStore({
      fields:['contractNo','value','company']
     });
     var data=[{
      'contractNo':'a100001','value':'100','company':'HP'
     }];
    
     var header=new Ext.Panel({
      height:70,
      region:'north'
     });
     var cols=[
      {header:'contractNo',width:160},
      {header:'value',width:160},
      {header:'company',width:160}
     ];
     var center=new Ext.grid.GridPanel({
      width:200,
      region:'center',
      columns:cols,
      store:mystore,
      stripeRows:true 
     });
     new Ext.Viewport({
      layout:'border',
      items:[header,center]
     });
    
     mystore.loadData(data);
    });
    Daniel Jagszent
    [email protected]??gsze?t.de <- convert to plain ASCII to get my email address

Similar Threads

  1. Configurable submitFormat on date fields in JsonStore
    By Springvar in forum Ext 3.x: Help & Discussion
    Replies: 1
    Last Post: 18 Mar 2011, 4:52 AM
  2. ComboBox Can't display the value Which in the JsonStore.
    By starnetcjl in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 16 Jun 2009, 6:21 PM
  3. Replies: 5
    Last Post: 20 May 2008, 6:13 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •