Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script type="text/javascript">
- Ext.require([
- 'Ext.data.*',
- 'Ext.form.*'
- ]);
- Ext.onReady(function(){
- Ext.define("Post", {
- extend: 'Ext.data.Model',
- fields: [
- {name: 'intid_unit', mapping: 'intid_unit'},
- {name: 'strnama_unit', mapping: 'strnama_unit'},
- {name: 'strnama_dealer', mapping: 'strnama_dealer'},
- {name: 'strkode_dealer', mapping: 'strkode_dealer'},
- ]
- });
- var ds = Ext.create('Ext.data.Store', {
- pageSize: 10,
- model: 'Post',
- autoLoad: true,
- proxy: {
- type: 'ajax',
- url: 'http://localhost/tulip/coba1/coba/getUnitApi',
- reader: {
- type: 'json',
- root: 'coba',
- totalProperty: 'totalCount'
- }
- }
- });
- var panel = Ext.create('Ext.panel.Panel', {
- renderTo: Ext.getBody(),
- title: 'Search the Ext Forums',
- width: 600,
- bodyPadding: 10,
- layout: 'anchor',
- items: [{
- xtype: 'combo',
- store: ds,
- displayField: 'title',
- typeAhead: false,
- hideLabel: true,
- hideTrigger:true,
- anchor: '100%',
- listConfig: {
- loadingText: 'Searching...',
- emptyText: 'No matching posts found.',
- },
- pageSize: 10,
- // override default onSelect to do redirect
- listeners: {
- select: function(combo, selection) {
- var post = selection[0];
- /*if (post) {
- window.location =
- Ext.String.format('http://www.sencha.com/forum/showthread.php?t={0}&p={1}', post.get('topicId'), post.get('id'));
- }*/
- }
- }
- }, {
- xtype: 'component',
- style: 'margin-top:10px',
- html: 'Live search requires a minimum of 4 characters.'
- }]
- });
- });
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement