Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

going to specific pages in a data island.. 1

Status
Not open for further replies.

eja2000

Programmer
Nov 30, 2003
209
NG
how can i move to a specific page in an xml data island?
for example i have paged my 20 record xml data island to show a record at a time.
i want to create a link to go directly to the 5th record..
how do i do this?
 
put index to property childNodes:
elemend.childNodes[5]
Code:
<html>
<head>
  <!--Template of XML Data Island, Author Ion Filipski-->
  <title>zzz</title>
</head>
<body>
  <xml id=&quot;xmlmeetings&quot;>
    <?xml version=&quot;1.0&quot;?>
    <meetings>
      <meeting>
        <date>1/1/99</date>
        <time>9:00</time>
        <location>104</location>
      </meeting>
      <meeting>
        <date>2/1/99</date>
        <time>13:00</time>
        <location>34</location>
      </meeting>
      <meeting>
        <date>3/1/99</date>
        <time>14:30</time>
        <location>20</location>
      </meeting>
    </meetings>
  </xml>
  <script language=&quot;JScript&quot;>
    var meetings;
    var meeting;
    var name;
    var i;
    var j;
    meetings = xmlmeetings.documentElement.selectNodes(&quot;meeting&quot;);
    meeting = meetings[0];
    document.write(&quot;MSXMLDOM script bound<br/>&quot;);

    document.write(&quot;<table border=\&quot;1\&quot;>&quot;);
    document.write(&quot;  <thead>&quot;);
    document.write(&quot;  <tr>&quot;);
    for(j = 0; j < meeting.childNodes.length; j++)
    {
      document.write(&quot;    <td>&quot;);
      document.write(meeting.childNodes[j].nodeName);
      document.write(&quot;    </td>&quot;);
    }
    document.write(&quot;  </tr>&quot;);
    document.write(&quot;  </thead>&quot;);

    for(i = 0; i < meetings.length; i++)
    {
      meeting = meetings[i];
      document.write(&quot;  <tr>&quot;);
      for(j = 0; j < meeting.childNodes.length; j++)
      {
        document.write(&quot;    <td>&quot;);
        document.write(meeting.childNodes[j].text);
        document.write(&quot;    </td>&quot;);
      }
      document.write(&quot;  </tr>&quot;);
    }
    document.write(&quot;</table>&quot;);
  </script>

Ion Filipski
1c.bmp
 
thanks..
what i really want is a case where u use a data island and u set the datapagesize property to 1 so that only one record is displayed at a time eg.

<meeting>
<date>1/1/99</date>
<time>9:00</time>
<location>104</location>
</meeting>


no what i want is a link on some other page that will show me only the next &quot;page&quot;.

eg.
<meeting>
<date>2/1/99</date>
<time>13:00</time>
<location>34</location>
</meeting>

thanks..
the next, previous, first etc properties built into data islands do not help here...

 
make a button or a link with an action which is a javascript function. In that function do an update of the page as you can usual do in Javascript.

Ion Filipski
1c.bmp
 
can u give me an example of such code that could for example, cycle forward 4 times..
this simply means mimicing the data island's nextpage method 4 times..
thanks a lot..
 
Ok, try this one:
Code:
<html>
<head>
  <!--Template of XML Data Island, Author Ion Filipski-->
  <title>zzz</title>

  <xml id=&quot;xmlmeetings&quot;>
    <?xml version=&quot;1.0&quot;?>
    <meetings>
      <meeting>
        <date>1/1/99</date><time>9:00</time>
        <location>Munhen</location>
      </meeting>
      <meeting>
        <date>2/1/99</date><time>13:00</time>
        <location>Bucharest</location>
      </meeting>
      <meeting>
        <date>3/1/99</date><time>14:30</time>
        <location>NewYork</location>
      </meeting>
      <meeting>
        <date>3/1/99</date><time>14:30</time>
        <location>Paris</location>
      </meeting>
      <meeting>
        <date>3/1/99</date><time>14:30</time>
        <location>Beijing</location>
      </meeting>
    </meetings>
  </xml>
  <script language=&quot;JScript&quot;>
    var meetings;
    var meeting;
    var name;
    var i;
    var j;
    var currentPage = 0;
    var doc = document;
    meetings = xmlmeetings.documentElement.selectNodes(&quot;meeting&quot;);
    var x = 0;

    function doWriteHead()
    {
      doc.all.dbody.innerText = &quot;meeting {&quot; + x + &quot;}:      &quot;;
      meeting = meetings[x];
      doc.all.dbody.innerText = doc.all.dbody.innerText + &quot;date: &quot; + meeting.childNodes[0].text + &quot;      &quot;;
      doc.all.dbody.innerText = doc.all.dbody.innerText + &quot;time: &quot; + meeting.childNodes[1].text + &quot;      &quot;;
      doc.all.dbody.innerText = doc.all.dbody.innerText + &quot;location: &quot; + meeting.childNodes[2].text + &quot;      &quot;;
      
    }
    function doNext()
    {
      if(x < (meetings.length - 1))x++;
      doWriteHead();
    }
    function doPrev()
    {
      if(x > 0)x--;
      doWriteHead();
    }
  </script>
</head>
<body id>
  press next or prev page to view meetings:<br/>
  <a onclick=&quot;javascript:doPrev();&quot;>prev page</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a onclick=&quot;javascript:doNext();&quot;>next page</a>   
  <p id = &quot;dbody&quot;/>
</body>
</html>

Ion Filipski
1c.bmp
 
thanks man,

we are almost there..

now in ur example we have three different meetings, right?
what i want are links that point to SPECIFIC MEETINGS..
like...go to meeting 1..
go to meeting 3, etc..

thank you..


lets say their are 4 &quot;pages&quot;
i want a link that willl take me to (for example) page 2 directly..
i don't need the next, previous thingy...


thanks 4 ur patient..
 
Code:
<html>
<head>
  <!--Template of XML Data Island, Author Ion Filipski-->
  <title>zzz</title>

  <xml id=&quot;xmlmeetings&quot;>
    <?xml version=&quot;1.0&quot;?>
    <meetings>
      <meeting>
        <date>1/1/99</date><time>9:00</time>
        <location>Munhen</location>
      </meeting>
      <meeting>
        <date>2/1/99</date><time>13:00</time>
        <location>Bucharest</location>
      </meeting>
      <meeting>
        <date>3/1/99</date><time>14:30</time>
        <location>NewYork</location>
      </meeting>
      <meeting>
        <date>3/1/99</date><time>14:30</time>
        <location>Paris</location>
      </meeting>
      <meeting>
        <date>3/1/99</date><time>14:30</time>
        <location>Beijing</location>
      </meeting>
    </meetings>
  </xml>
  <script language=&quot;JScript&quot;>
    var meetings;
    var meeting;
    var name;
    var i;
    var j;
    var currentPage = 0;
    var doc = document;
    meetings = xmlmeetings.documentElement.selectNodes(&quot;meeting&quot;);
    var x = 0;
    function doMeetingThree()
    {
      x = 2;
      doc.all.dbody.innerText = &quot;meeting {&quot; + (x + 1) + &quot;}:      &quot;;
      meeting = meetings[x];
      doc.all.dbody.innerText = doc.all.dbody.innerText + &quot;date: &quot; + meeting.childNodes[0].text + &quot;      &quot;;
      doc.all.dbody.innerText = doc.all.dbody.innerText + &quot;time: &quot; + meeting.childNodes[1].text + &quot;      &quot;;
      doc.all.dbody.innerText = doc.all.dbody.innerText + &quot;location: &quot; + meeting.childNodes[2].text + &quot;      &quot;;
      
    }

  </script>
</head>
<body id>
  click below to view meeting three:<br/>
  <a onclick=&quot;javascript:doMeetingThree();&quot;>third meeting</a><br/>
  <p id = &quot;dbody&quot;/>
</body>
</html>

Ion Filipski
1c.bmp
 
i have a data island on a page that lists just the meeting locations..

i want to link these to their respective pages on the data island above on another page..
what parameter can i pass from the first page (the page that has the locations data island)to the page containing meeting details?
thanks once again Ion...
 
The second sample contains the responce to your last question. Read more attentive the post.

Ion Filipski
1c.bmp
 
I've written there the code which gives you the possibility to enter the page number(the begin is the same with in the last post):
Code:
    function doSelect()
    {
      x = doc.all.pagenum.value;
      doPrev();
    }
  </script>
</head>
<body id>
  press next or prev page to view meetings:<br/>
  <a onclick=&quot;javascript:doPrev();&quot;>prev page</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a onclick=&quot;javascript:doNext();&quot;>next page</a><br/>
  <a onclick=&quot;javascript:doSelect();&quot;>select a page</a><input type=&quot;text&quot; id=&quot;pagenum&quot;></edit>
  <p id = &quot;dbody&quot;/>
</body>
</html>

Ion Filipski
1c.bmp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top