![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 5 Pomógł: 0 Dołączył: 13.09.2006 Ostrzeżenie: (0%) ![]() ![]() |
mam problem ze skryptem pobranym ze strony advAJAX odnosnie stronicowania stron. stworzylem wlasny plik xml ktory drukuje sie w nastepujacy sposob:
a poza tym nic nie zmienialem w skrypcie nie wiem co jest przyczyna ze nie stronicuje mi ani nie sortuje. prosze o pomoc. jak to naprawde dziala mozecie zobaczyc tutaj |
|
|
![]() |
![]()
Post
#2
|
|
Grupa: Zarejestrowani Postów: 5 Pomógł: 0 Dołączył: 13.09.2006 Ostrzeżenie: (0%) ![]() ![]() |
przeciez napisalem jaki skrypt wzialem!!! jakby mi zalezalo na stronicowaniu z przeladowaniem to bez problemu bym sobie poradzil, ale mi chodzi o przyklad ze strony anakin.
Kod var currentPage = 0;
var currentSort = ""; var currentSortOrder = "ASC"; var maxPage; var defaultTableData; function $(id) { return document.getElementById(id); } function parseRecords(xml) { with (xml.getElementsByTagName("records").item(0)) { page = getAttribute("page")*1; maxPerPage = getAttribute("max_per_page"); startId = maxPerPage*page+1; total = getAttribute("total")*1; maxPage = Math.ceil(total/maxPerPage); $("dataStats").innerHTML = "Rekordy: " + startId + " - " + (startId+getAttribute("count")*1-1) + " z " + total + " (Strona: " + (page+1) + " z " + maxPage + ")"; } $("btnFirst").style.visibility = $("btnPrev").style.visibility = page == 0 ? "hidden" : "visible"; $("btnLast").style.visibility = $("btnNext").style.visibility = page+1 == maxPage ? "hidden" : "visible"; d = $("dataTable"); for (i = d.rows.length-1; i >= 0; i--) d.deleteRow(i); record = xml.getElementsByTagName("record"); result = ""; for (i = 0; i < record.length; i++) { tr = document.createElement("tr"); td = document.createElement("td"); td.innerHTML = startId + i; tr.appendChild(td); for (j = 0; j < 3; j++) { td = document.createElement("td"); td.innerHTML = record[i].childNodes[j].childNodes[0].nodeValue; tr.appendChild(td); } d.appendChild(tr); } return result; } function getRecords() { advAJAX.get({ url : "spis.php?p="+currentPage+"&s="+currentSort+"%20"+currentSortOrder, onInitialization : function() { $("dataStats").innerHTML = '<span style="font-weight: bold">Pobieranie danych...</span>'; $("btnPrev").style.visibility = "hidden"; $("btnNext").style.visibility = "hidden"; $("btnFirst").style.visibility = "hidden"; $("btnLast").style.visibility = "hidden"; }, onSuccess : function(obj) { parseRecords(obj.responseXML); } }); } function changeSort(s) { if (currentSort == s) currentSortOrder = currentSortOrder == "ASC" ? "DESC" : "ASC"; else { currentSortOrder = "ASC"; if (currentSort != "") $(currentSort + "Sort").style.fontWeight = "normal"; $(s + "Sort").style.fontWeight = "bold"; } currentSort = s; changePage(0); } function changePage(p) { currentPage += p; getRecords(); } function initDynamicTable() { changeSort("surname"); } Ten post edytował krolp 18.09.2006, 00:10:52 |
|
|
![]() ![]() |
![]() |
Aktualny czas: 10.10.2025 - 06:52 |