My front page paging

Source: Internet
Author: User

As follows:

@{
Viewbag.title = "OrderList";
Layout = "~/views/shared/_layout.cshtml";
}
<script src= "~/scripts/tminjicommon.js" ></script>
<script>
(function () {

var getorderlist = function (pagenumber, pageSize) {
$.ajax ({
Type: "Post",
DataType: "JSON",
URL: "/order/getallorder",
Async:true,
Cache:false,
Data: {pagenumber:pagenumber, pagesize:pagesize},
Success:function (data) {
if (data. F = = 1) {
Alert (data. M);
Return
}

var firstpage = 1;
var prepage = 1;
var nextPage = 1;
var lastpage = 1;
var currentpage = 1;

if (data. O = = NULL | | Data. O.length = = 0) {
$ ("#pageInfo"). HTML ("Sorry, no data!"). ");
}
else {
CurrentPage = Math.ceil (data. O[0]. REQINDEX/10);
LastPage = Math.ceil (data. O[0]. REQCOUNT/10);
Prepage = currentPage-1;
NextPage = currentpage + 1;
if (Prepage < 1)
Prepage = 1;
if (NextPage > LastPage)
NextPage = LastPage

                         $ ("#firstPage"). One ("click", Function () {
                              $ ("#pcontent"). HTML ("");
                             $ ("#pageInfo"). HTML ("Get Data ...");
                             getorderlist (1, 10);
                        });

                         $ ("#prePage"). One ("click", Function () {
                              $ ("#pcontent"). HTML ("");
                             $ ("#pageInfo"). HTML ("Get Data ...");
                             getorderlist (Prepage, 10);
                        });

                         $ ("#nextPage"). One ("click", Function () {
                              $ ("#pcontent"). HTML ("");
                             $ ("#pageInfo"). HTML ("Get Data ...");
                             getorderlist (NextPage, 10);
                        });

                         $ ("#lastPage"). One ("click", Function () {
                              $ ("#pcontent"). HTML ("");
                             $ ("#pageInfo"). HTML ("Get Data ...");
                             getorderlist (LastPage, 10);
                        });

var pi = "Total" + data. O[0]. Reqcount + "bar, Total"
+ lastpage + "page, current section"
+ currentpage + "page";//+ ", prev" + prepage + "Next page" + nextPage;

$ ("#pageInfo"). html (PI);
}

var con = "";
Alert (data. F);
$.each (data. O, function (I, item) {
Con + = ' <tr> ';
Con + = ' <td><input type= ' checkbox ' name= ' checkbox '/></td> ';
Con + = ' <td> ' + item. UserName + ' </td> ';
Con + = ' <td> ' + item.order_code + ' </td> ';
Con + = ' <td>¥ ' + Item.price1 + ' </td> ';
Con + = ' <td> ' + tminjicommon.formattime (item.order_time) + ' </td> ';
Con + = ' <td><span class= ' label label-important > Unpaid </span></td> ';
Con + = ' <td><span class= ' label label-important > Not shipped </span></td> ';
Con + = ' <td><span class= ' label label-success > Details </span></td> ';
Con + = ' <td></td> ';
Con + = ' </tr> ';
});
Alert (data. F);

$ ("#orderCon"). html (con);
},
Error:function (XHR, status, err) {
alert (ERR);
}
});
};

return Tminji = {
Getorderlist:getorderlist
};
})();

$ (function () {
Tminji.getorderlist (1, 10);
});
</script>

<div class= "Panel Panel-default" >
<div class= "panel-heading" > Order Management </div>
<div class= "Panel-body" >
<div class= "Panel" >
<table>
<tr>
<td> Order Number:</td>
<td><input type= "text" name= "Search1" id= "Search1" value= ""/></td>
<td><button class= "btn btn-warning" type= "button" > Search </button></td>
&LT;TD style= "width:5px;" ></td>
</tr>
</table>
</div>
<div class= "Panel Panel-default" >
<table class= "Table table-striped table-bordered table-hover" >
<thead>
<tr>
<th width= "" ><input type= "checkbox" class= "Checkall"/></th>
<th width= ">" Purchase member </th>
<th width= "+" > Order number </th>
<th width= > Order Total Price </th>
<th width= "" > Order Time </th>
<th width= "$" > Payment status </th>
<th width= "Up" > Distribution status </th>
<th width= "> Operation </th>
</tr>
</thead>
<tbody id= "Ordercon" ></tbody>
</table>
</div>

<div>
<span><a href= "#" id= "FirstPage" > Home </a></span>
<span><a href= "#" id= "Prepage" > Prev </a></span>
<span><a href= "#" id= "NextPage" > Next </a></span>
<span><a href= "#" id= "LastPage" > End </a></span>
<span id= "PageInfo" ></span>
</div>
</div>

</div>

My front page paging

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.