Ext


Go Back   Ext JS Forums > Ext JS Community Forums (3.0) > Ext: Help

Reply
 
Thread Tools
  #1  
Old 11-05-2009, 05:29 AM
R.J R.J is offline
Ext User
 
Join Date: May 2009
Posts: 1
R.J is on a distinguished road
Exclamation Unable to create GridPanel in TabPanel with error on line 13522 object expected

Dear All,

I am new to Extjs and want to create a grid panel into a tabpanel which is in center region of border layout.

Below is my code. can any give me the correct code to do the needful.
Thanks in Advance.

<html>
<head><style>
.milton-icon {
background: url(\lib\ext-3.0.0\resources\images\default\window\icon-warning.gif) no-repeat;
}
</style>
<title>Getting Started Example</title>
<link rel="stylesheet" type="text/css"
href="lib/ext-3.0.0/resources/css/ext-all.css" />
<script src="/lib/ext-3.0.0/adapter/ext/ext-base.js"></script>
<script src="/lib/ext-3.0.0/ext-all-debug.js"></script>
<script>

Ext.onReady(function(){

var viewport = new Ext.Viewport({
layout: 'border',
renderTo: Ext.getBody(),
items: [{
region: 'north',
xtype: 'panel',
html: 'North',
frame:true
},{
region: 'west',
xtype: 'panel',
split: true,
width: 200,
html: 'West'
},{
region: 'center',
xtype: 'tabpanel',
activeTab: 1,
width:'auto',
items:[{xtype :'gridpanel',
title:'tab1'
},{
xtype:'panel',
items: [grid]
}]


},{
region: 'south',
xtype: 'panel',
html: 'South'
}]
});



});


var grid = new Ext.grid.GridPanel({
renderTo: document.body,
//frame:true,
title: 'Movie Database',
//height:800,
//width:500,
store: store,
columns: [
{header: 'Cover', dataIndex: 'coverthumb', renderer:cover_image},
{header: 'Title', dataIndex: 'title', renderer: title_tagline},
{header: "Director", dataIndex: 'director'},
{header: "Released", dataIndex: 'released',
renderer: Ext.util.Format.dateRenderer('m/d/Y')},
{header: "Genre", dataIndex: 'genre'},
{header: 'Tagline', dataIndex: 'tagline', hidden: true}
]




//----------
});
var store = new Ext.data.Store({
data: [
[
1,
"Office Space",
"Mike Judge",
"1999-02-19",
1,
"Work Sucks",
"19.95",
1
],[
3,
"Super Troopers",
"Jay Chandrasekhar",
"2002-02-15",
1,
"Altered State Police",
"14.95",
1
]
//...more rows of data removed for readability...//
]
,
reader: new Ext.data.ArrayReader({id:'id'}, [
'id',
'title',
'director',
{name: 'released', type: 'date', dateFormat: 'Y-m-d'},
'genre',
'tagline',
'price',
'available'
]

)
});


function cover_image(val){
return '<img src=\lib\ext-3.0.0\resources\images\default\window\icon-warning.gif/>';
}

function title_tagline(val, x, store){
return '<b>'+val+'</b><br>'+store.data.tagline;
}




</script>
</head>
<body>
<div id='my_id'
style='width:200px;height:200px;'>test</div>
<!-- Nothing in the body -->
</body>
</html>
Reply With Quote
  #2  
Old 11-05-2009, 07:46 AM
Animal's Avatar
Animal Animal is offline
Ext JS - Community Support Team
 
Join Date: Mar 2007
Location: East Midlands, UK
Posts: 23,358
Animal will become famous soon enough
Default

Two things.

DO NOT wrap any grid inside a Panel to add it to a TabPanel. Just ADD it to the TabPanel.

Create "grid" before you attempt to do ANYTHING with it!
__________________
ExtJs forum volunteer. No official connection to the Ext Company. I do not speak for them.
ExtJs consultancy offered. £ 50/hour. Evenings+weekends. the_bagbournes@btinternet.com

Search the forum: http://www.google.com/coop/cse?cx=01...%3Az7of1ufqccu
Read the docs too: http://extjs.com/deploy/dev/docs/
See Saki's samples: http://examples.extjs.eu/
Build your own Ext: http://extjs.com/products/extjs/build/
Scope: http://extjs.com/forum/showthread.ph...642#post257642
Reply With Quote
  #3  
Old 11-05-2009, 07:46 AM
Animal's Avatar
Animal Animal is offline
Ext JS - Community Support Team
 
Join Date: Mar 2007
Location: East Midlands, UK
Posts: 23,358
Animal will become famous soon enough
Default

And format any code you post in [code]...[/code] tags!
__________________
ExtJs forum volunteer. No official connection to the Ext Company. I do not speak for them.
ExtJs consultancy offered. £ 50/hour. Evenings+weekends. the_bagbournes@btinternet.com

Search the forum: http://www.google.com/coop/cse?cx=01...%3Az7of1ufqccu
Read the docs too: http://extjs.com/deploy/dev/docs/
See Saki's samples: http://examples.extjs.eu/
Build your own Ext: http://extjs.com/products/extjs/build/
Scope: http://extjs.com/forum/showthread.ph...642#post257642
Reply With Quote
Reply

Thread Tools

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

All times are GMT -5. The time now is 04:21 PM.

© 2006-2009 Ext, LLC
Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.