tailieunhanh - Dojo Using the Dojo JavaScript Library to Build Ajax Applications phần 6

Tạo ra một widget có thể hiển thị các panel khác nhau của nội dung bằng cách chồng các nội dung ẩn và cung cấp một điều khiển người dùng có thể nhấp vào để hiển thị nội dung ẩn. Hầu hết các container bố trí có thể chứa các trẻ em của bất kỳ loại nội dung. Tuy nhiên, widget này phải có con của AccordionPane loại. | 150 Chapter 8 Dojo Layout Widgets Widget Name Super Classes File Location Usage dijit form Use Creates a widget that can display different panes of content by stacking the hidden content and providing a control the user can click to display the hidden content. Most layout containers can contain children of any content type. However this widget must have children of type AccordionPane. The reason for this is that each child must have a title bar with a label and a control. AccordionPane acts as a wrapper around ContentPane and adds the additional features for title and control. This widget contains children of type AccordionPane which can contain any content including other layout widgets. When the widget is first built one pane is visible and the other panes are stacked beneath it with only their controls showing. When the control icon is clicked the first pane will close and the clicked pane will slide open producing an effect like an accordion being played hence the name . Display Examples HTML Markup Examples Notice that the Pane Control Icon is different depending on whether the pane is open or closed. Only one pane may be open at a time. The user can click anywhere on the pane control to open it not just on the icon . Create a new AccordionContainer widget with three children each of type AccordionPane. div id sc dojoType duration 25 div id c1 dojoType title Pane 1 p style padding 20px First Widget p div Explanation of Dojo Layout Widgets 151 div id c1 dojoType title Pane 2 p style padding 20px Second Widget p div div id c1 dojoType title Pane 3 p style padding 20px Third Widget p div div JavaScript The following code will create a new AccordionContainer widget Constructor .