EXT 2.0 combos User Guide

Source: Internet
Author: User

This is a simple example. You just need to explain it in a step-by-step manner, from simple to complex!

The example consists of two parts: lcombo.html and lcombo. js.

Lcombo.html

View plain
Copy to clipboard
Print
?
  1. <! Doctype HTML public
    "-// W3C // dtd html 4.01 transitional // en"

  2. Http://www.w3.org/TR/html4/loose.dtd"
    >
  3. <HTML>
  4. <Head>
  5. <Meta http-equiv = "Content-Type"
    Content =
    "Text/html; charset = UTF-8"
    >
  6. <LINK rel = "stylesheet"
    Type =
    "Text/CSS"
    Href =
    "../Extjs-2.0/resources/CSS/ext-all.css"
    >
  7. <SCRIPT type = "text/JavaScript"
    Src =
    "../Extjs-2.0/adapter/EXT/ext-base.js"
    > </SCRIPT>
  8. <SCRIPT type = "text/JavaScript"
    Src =
    "../Extjs-2.0/ext-all-debug.js"
    > </SCRIPT>
  9. <SCRIPT type = "text/JavaScript"
    Src =
    "Lcombo. js"
    > </SCRIPT>
  10. <! -- A localization script file comes here -->
  11. <SCRIPT type = "text/JavaScript"
    >
  12. Ext. onready (lcombo. App. init, lcombo. app );
  13. </SCRIPT>
  14. <Title> linked combos example </title>
  15. </Head>
  16. <Body>
  17. </Body>
  18. </Html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"     "http://www.w3.org/TR/html4/loose.dtd">

This is ext's smallest HTML!
Do not forget to change the ext class library and resource references to deploy your ext!

Lcombo. js

View plain
Copy to clipboard
Print
?
  1. /**
     
  2. * Ext 2.0 linked combos tutorial
     
  3. * By Jozef sakalos, aka Saki
     
  4. * Extjs.com/learn/tutorial:linked_combos_tutorial_for_ext_2
     
  5. */

  6. // Reference local blank image

  7. Ext. blank_image_url = '../extjs-2.0/resources/images/default/s.gif'
    ;
  8. Ext. namespace ('lcombo'
    ,
    'Lcombo. Countries'
    ,
    'Lcombo. Cities'
    );
  9. Lcombo. Countries = [
  10. ['Usa'
    ,
    'United States of America'
    ]
  11. , ['D'
    ,
    'Germany'
    ]
  12. , ['F'
    ,
    'France'
    ]
  13. , ['Gb'
    ,
    'Great Britain'
    ]
  14. ];
  15. Lcombo. Cities = [
  16. [1, 'usa'
    ,
    'New York'
    ]
  17. , [2, 'usa'
    ,
    'Cleveland'
    ]
  18. , [3, 'usa'
    ,
    'Austin'
    ]
  19. , [4, 'usa'
    ,
    'Los Angeles'
    ]
  20. , [5, 'D'
    ,
    'Berline'
    ]
  21. , [6, 'D'
    ,
    'Bonn'
    ]
  22. , [7, 'F'
    ,
    'Paris'
    ]
  23. , [8, 'F'
    ,
    'Nice'
    ]
  24. , [9, 'gb'
    ,
    'London'
    ]
  25. , [10, 'gb'
    ,
    'Glasgow'
    ]
  26. , [11, 'gb'
    ,
    'Verpool'
    ]
  27. ];
  28. // Create Application

  29. Lcombo. APP = Function
    (){
  30. // Do not access DOM from here; elements don't exist yet

  31. // Private Variables

  32. // Private Functions

  33. // Public Space

  34. Return
    {
  35. // Public methods

  36. Init: Function
    (){
  37. VaR
    Form =
    New
    Ext. formpanel ({
  38. Renderto: Document. Body
  39. , Width: 400
  40. , Height: 300
  41. , Style: 'margin: 16px'

  42. , Bodystyle: 'padding: 10px'

  43. , Title: 'linked combos'

  44. , Defaults: {xtype: 'combo'
    }
  45. , Items :[{
  46. Fieldlabel: 'select country'

  47. , Displayfield: 'country'

  48. , Valuefield: 'cid'

  49. , Store: New
    Ext. Data. simplestore ({
  50. Fields: ['cid'
    ,
    'Country'
    ]
  51. , Data: lcombo. Countries
  52. })
  53. , Triggeraction: 'all'

  54. , Mode: 'local'

  55. , Listeners: {select: {fn: Function
    (Combo, value ){
  56. VaR
    Combocity = ext. getcmp (
    'Combo-City'
    );
  57. Combocity. setvalue (''
    );
  58. Combocity. Store. Filter ('cid'
    , Combo. getvalue ());
  59. }}
  60. }
  61. },{
  62. Fieldlabel: 'select City'

  63. , Displayfield: 'city'

  64. , Valuefield: 'id'

  65. , ID: 'combo-City'

  66. , Store: New
    Ext. Data. simplestore ({
  67. Fields: ['id'
    ,
    'Cid'
    ,
    'City'
    ]
  68. , Data: lcombo. Cities
  69. })
  70. , Triggeraction: 'all'

  71. , Mode: 'local'

  72. , Lastquery :''

  73. }]
  74. });
  75. }
  76. };
  77. } (); // End of app

  78. // End of File


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.