Skip to content

Instantly share code, notes, and snippets.

@ExtAnimal
Created March 13, 2012 06:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ExtAnimal/2027200 to your computer and use it in GitHub Desktop.
Save ExtAnimal/2027200 to your computer and use it in GitHub Desktop.
Auto height grid
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Auto heihght grid</title>
<link rel="stylesheet" type="text/css" href="../../resources/css/ext-all.css" />
<link rel="stylesheet" type="text/css" href="../shared/example.css" />
<script type="text/javascript" src="../../ext-all.js"></script>
<script type="text/javascript">
Ext.Loader.setConfig({enabled: true});
Ext.Loader.setPath('Ext.ux', '../ux/');
Ext.require([
'*',
'Ext.ux.ajax.JsonSimlet',
'Ext.ux.ajax.SimManager'
]);
Ext.onReady(function() {
Ext.define('Thing', {
extend: 'Ext.data.Model',
fields: ['name']
})
var simlet = new Ext.ux.ajax.JsonSimlet({
data: [{
"name": "Item 1"
}, {
"name": "Item 2"
}, {
"name": "Item 3"
}, {
"name": "Item 4"
}, {
"name": "Item 5"
}, {
"name": "Item 6"
}, {
"name": "Item 7"
}, {
"name": "Item 8"
}, {
"name": "Item 9"
}, {
"name": "Item 10"
}, {
"name": "Item 11"
}]
});
Ext.ux.ajax.SimManager.init({
delay: 1000
}).register({
localAjaxSimulator: simlet
});
var store = Ext.create('Ext.data.Store', {
model: 'Thing',
autoLoad: true,
proxy: {
type: 'ajax',
url: 'data.php'
}
});
/*
var grid = Ext.create('Ext.grid.Panel', {
renderTo: document.body,
width: 300,
store: store,
viewConfig: {
loadingHeight: 100
},
columns: [{
text: 'Name',
dataIndex: 'name',
flex: 1
}]
});
*/
Ext.create('Ext.panel.Panel', {
layout: 'fit',
renderTo: document.body,
width: 300,
items: {
loadingHeight: 50,
xtype: 'dataview',
store: store,
itemTpl: '{name}'
}
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment