Advertisement
fahmihilmansyah

ext1

Apr 22nd, 2014
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.36 KB | None | 0 0
  1. <script type="text/javascript">
  2. Ext.require([
  3. 'Ext.data.*',
  4. 'Ext.form.*'
  5. ]);
  6.  
  7. Ext.onReady(function(){
  8.  
  9. Ext.define("Post", {
  10. extend: 'Ext.data.Model',
  11. fields: [
  12. {name: 'intid_unit', mapping: 'intid_unit'},
  13. {name: 'strnama_unit', mapping: 'strnama_unit'},
  14. {name: 'strnama_dealer', mapping: 'strnama_dealer'},
  15. {name: 'strkode_dealer', mapping: 'strkode_dealer'},
  16.  
  17. ]
  18. });
  19.  
  20. var ds = Ext.create('Ext.data.Store', {
  21. pageSize: 10,
  22. model: 'Post',
  23. autoLoad: true,
  24. proxy: {
  25. type: 'ajax',
  26. url: 'http://localhost/tulip/coba1/coba/getUnitApi',
  27. reader: {
  28. type: 'json',
  29. root: 'coba',
  30. totalProperty: 'totalCount'
  31. }
  32. }
  33. });
  34.  
  35.  
  36. var panel = Ext.create('Ext.panel.Panel', {
  37. renderTo: Ext.getBody(),
  38. title: 'Search the Ext Forums',
  39. width: 600,
  40. bodyPadding: 10,
  41. layout: 'anchor',
  42.  
  43. items: [{
  44. xtype: 'combo',
  45. store: ds,
  46. displayField: 'title',
  47. typeAhead: false,
  48. hideLabel: true,
  49. hideTrigger:true,
  50. anchor: '100%',
  51.  
  52. listConfig: {
  53. loadingText: 'Searching...',
  54. emptyText: 'No matching posts found.',
  55.  
  56.  
  57. },
  58. pageSize: 10,
  59.  
  60. // override default onSelect to do redirect
  61. listeners: {
  62. select: function(combo, selection) {
  63. var post = selection[0];
  64. /*if (post) {
  65. window.location =
  66. Ext.String.format('http://www.sencha.com/forum/showthread.php?t={0}&p={1}', post.get('topicId'), post.get('id'));
  67. }*/
  68. }
  69. }
  70. }, {
  71. xtype: 'component',
  72. style: 'margin-top:10px',
  73. html: 'Live search requires a minimum of 4 characters.'
  74. }]
  75. });
  76. });
  77. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement