Created
March 13, 2012 06:14
-
-
Save ExtAnimal/2027200 to your computer and use it in GitHub Desktop.
Auto height grid
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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