2005년 9월 8일 목요일

[펌] 23. 데이터 바인딩을 사용해서 XML 문서 출력하기(3)

페이징 사용하기

 

1. 바인딩된 TABLE 엘리먼트의 DATAPAGESIZE 속성을 한번에 출력하기 원하는 레코드의 최대 개수로 설정한다.

 

 <table datasrc="#dsoXMLFile1" DATAPAGESIZE="5" border="1" cellpadding="5">

 

2. TABLE 엘리먼트 메소드를 호출한다.

TABLE 엘리먼트 메소드 효과 예제호출
firstPage 레코드의 첫 페이지를 보여준다. InventoryTable.firstPage()
previousPage 레코드의 이전 페이지를 보여준다. InventoryTable.previousPage()
nextPage 레코드의 다음 페이지를 보여준다. InventoryTable.nextPage()
lastPage 레코드의 마지막 페이지를 보여준다. InventoryTable.lastPage()

 

 

3. BUTTON HTML 엘리먼트의 ONCLICK 속성을 메소드로 지정한다.

<body>
   <xml id="dsoXMLFile1" src="XMLFile1.xml"></xml>
   <h2>Book Inverntory</h2>
   <button onclick="dsoXMLFile1.firstPage()">|&lt; 첫 페이지</button>
   <button onclick="dsoXMLFile1.previousPage()" ID="Button1">&lt; 이전 페이지</button>
   <button onclick="dsoXMLFile1.nextPage()" ID="Button2">다음 페이지&gt;</button>
   <button onclick="dsoXMLFile1.lastPage()" ID="Button3">마지막 페이지 &gt;|</button>

   <table datasrc="#dsoXMLFile1" datapagesize="5" border="1" cellpadding="5">
      <thead>
         <th>Title</th>
         <th>Author</th>
         <th>Binding</th>
         <th>Pages</th>
         <th>Price</th>
      </thead>
      <tr align="center">
         <td><span datafld="TITLE" style="font-style:italic"></span></td>
         <td><span datafld="AUTHOR"></span></td>
         <td><span datafld="BINDING"></span></td>
         <td><span datafld="PAGES"></span></td>
         <td><span datafld="PRICE"></span></td>
      </tr>
   </table>
</body>

 

 

4. 결과화면.


댓글 없음:

댓글 쓰기