Web Interface For Lite Argus Control modules
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
2.0 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /*!
  2. * Ext JS Library 3.3.1
  3. * Copyright(c) 2006-2010 Sencha Inc.
  4. * licensing@sencha.com
  5. * http://www.sencha.com/license
  6. */
  7. Ext.onReady(function(){
  8. var ds = new Ext.data.Store({
  9. proxy: new Ext.data.ScriptTagProxy({
  10. url: 'http://extjs.com/forum/topics-remote.php'
  11. }),
  12. reader: new Ext.data.JsonReader({
  13. root: 'topics',
  14. totalProperty: 'totalCount',
  15. id: 'post_id'
  16. }, [
  17. {name: 'postId', mapping: 'post_id'},
  18. {name: 'title', mapping: 'topic_title'},
  19. {name: 'topicId', mapping: 'topic_id'},
  20. {name: 'author', mapping: 'author'},
  21. {name: 'lastPost', mapping: 'post_time', type: 'date', dateFormat: 'timestamp'},
  22. {name: 'excerpt', mapping: 'post_text'}
  23. ]),
  24. baseParams: {limit:20, forumId: 4}
  25. });
  26. // Custom rendering Template for the View
  27. var resultTpl = new Ext.XTemplate(
  28. '<tpl for=".">',
  29. '<div class="search-item">',
  30. '<h3><span>{lastPost:date("M j, Y")}<br />by {author}</span>',
  31. '<a href="http://extjs.com/forum/showthread.php?t={topicId}&p={postId}" target="_blank">{title}</a></h3>',
  32. '<p>{excerpt}</p>',
  33. '</div></tpl>'
  34. );
  35. var panel = new Ext.Panel({
  36. applyTo: 'search-panel',
  37. title:'Forum Search',
  38. height:300,
  39. autoScroll:true,
  40. items: new Ext.DataView({
  41. tpl: resultTpl,
  42. store: ds,
  43. itemSelector: 'div.search-item'
  44. }),
  45. tbar: [
  46. 'Search: ', ' ',
  47. new Ext.ux.form.SearchField({
  48. store: ds,
  49. width:320
  50. })
  51. ],
  52. bbar: new Ext.PagingToolbar({
  53. store: ds,
  54. pageSize: 20,
  55. displayInfo: true,
  56. displayMsg: 'Topics {0} - {1} of {2}',
  57. emptyMsg: "No topics to display"
  58. })
  59. });
  60. ds.load({params:{start:0, limit:20, forumId: 4}});
  61. });