| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152 |
- <?xml version="1.0" encoding="UTF-8"?>
- <?xml-stylesheet href="../../css/body.css" type="text/css" ?>
- <xhtml:html xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.w3.org/2002/01/xforms" xmlns:ev="http://www.w3.org/2001/xml-events">
- <xhtml:head>
- <xhtml:title>Untitle</xhtml:title>
- <model id="model1">
- <instance id="instance1">
- <root xmlns="">
- <navInfo>
- <PageNo/>
- </navInfo>
- </root>
- </instance>
- </model>
- <script type="javascript">
- <![CDATA[
- function JsGridClass(datagrid, nodeset) {
- var pageNo = 1;
- var pageCount = 0;
- this.setItem = function() {
- var count = Math.ceil(Number(model.getXPathValue("count(" + nodeset + ")")) / 20);
- if (count == 1) {
- grpPages.visible = false;
- return;
- }
- grpPages.visible = true;
- for (var i = count; i < pageCount; i++) {
- model.removenode(nodeset + "[last()]");
- }
- for (var i = pageCount + 1; i <= count; i++) {
- model.makeValue("/root/navInfo/item["+i+"]/PageNo", i);
- }
- pageCount = count;
- }
- this.firstPage = function() {
- pageNo = 1;
- this.setPage();
- }
- this.prevPage = function() {
- pageNo--;
- this.setPage();
- }
- this.nextPage = function() {
- pageNo++;
- this.setPage();
- }
- this.lastPage = function() {
- pageNo = pageCount;
- this.setPage();
- }
- this.setPage = function(page) {
- showProgressBar();
- if (typeof page == "number") pageNo = page;
- var startposition = (pageNo - 1) * 20;
- var endposition = pageNo * 20;
- // datagrid.nodeset = nodeset + "[position()>" + startposition + " and position()<=" + endposition + "]";
- datagrid.nodeset = nodeset + "[ROWNUM>" + startposition + " and ROWNUM<=" + endposition + "]";
- datagrid.setSeqRowHeader(parseInt(startposition + 1));
- if (pageNo == 1) {
- btnFirst.disabled = true;
- btnPrev.disabled = true;
- btnNext.disabled = false;
- btnLast.disabled = false;
- } else if (pageNo == pageCount) {
- btnFirst.disabled = false;
- btnPrev.disabled = false;
- btnNext.disabled = true;
- btnLast.disabled = true;
- } else {
- btnFirst.disabled = false;
- btnPrev.disabled = false;
- btnNext.disabled = false;
- btnLast.disabled = false;
- }
- model.makeValue("/root/navInfo/PageNo", pageNo);
- try {
- pageInit();
- } catch (e) {}
- removeProgressBar();
- }
- this.isLastPage = function() {
- return pageNo == pageCount;
- }
- }
- ]]>
- </script>
- </xhtml:head>
- <xhtml:body pagewidth="460" pageheight="30">
- <group id="grpPages" style="left:0px; top:0px; width:390px; height:30px; ">
- <button id="btnFirst" disabled="true" style="left:5px; top:5px; width:85px; height:20px; background-image:../../images/cal_pre_y.gif; ">
- <caption>第一页</caption>
- <script type="javascript" ev:event="onclick">
- <![CDATA[
- try {
- JsGridObject.firstPage();
- } catch(e) {}
- ]]>
- </script>
- </button>
- <caption id="caption1" style="left:305px; top:5px; width:15px; height:20px; ">第</caption>
- <caption id="caption2" style="left:375px; top:5px; width:15px; height:20px; ">页</caption>
- <select1 id="combo1" ref="/root/navInfo/PageNo" appearance="minimal" style="left:320px; top:5px; width:50px; height:20px; ">
- <choices>
- <itemset nodeset="/root/navInfo/item">
- <label ref="PageNo"/>
- <value ref="PageNo"/>
- </itemset>
- </choices>
- <script type="javascript" ev:event="xforms-value-changed">
- <![CDATA[
- try {
- JsGridObject.setPage(Number(event.pTarget.value));
- } catch(e) {}
- ]]>
- </script>
- </select1>
- <button id="btnPrev" disabled="true" style="left:80px; top:5px; width:85px; height:20px; background-image:../../images/cal_pre_m.gif; ">
- <caption>上一页</caption>
- <script type="javascript" ev:event="onclick">
- <![CDATA[
- try {
- JsGridObject.prevPage();
- } catch(e) {}
- ]]>
- </script>
- </button>
- <button id="btnNext" style="left:155px; top:5px; width:85px; height:20px; background-image:../../images/cal_next_m.gif; ">
- <caption>下一页</caption>
- <script type="javascript" ev:event="onclick">
- <![CDATA[
- try {
- JsGridObject.nextPage();
- } catch(e) {}
- ]]>
- </script>
- </button>
- <button id="btnLast" style="left:230px; top:5px; width:85px; height:20px; background-image:../../images/cal_next_Y.gif; ">
- <caption>最末页</caption>
- <script type="javascript" ev:event="onclick">
- <![CDATA[
- try {
- JsGridObject.lastPage();
- } catch(e) {}
- ]]>
- </script>
- </button>
- </group>
- </xhtml:body>
- </xhtml:html>
|