如何使用jquery与使用ajaxcall从asmx页面检索的datalist进行客户端分页 [英] how to do client side pagination using jquery with the datalist retrieved from asmx page using ajaxcall
问题描述
我有一个使用ajax调用从asmx页面返回的对象列表...在成功函数上我想将这个列表绑定到一个页面上有10个dataobjetcs的div元素...
i have a list of objects returned from asmx page using ajax call...on success function i want to bind this list to a div element with 10 dataobjetcs at a page...
推荐答案
有很多jQuery插件可以提供分页功能。
jQuery分页插件 [ ^ ]
一个很好的基于网格的插件,提供分页功能, DataTables [ ^ ]。如果你不限制自己分页div元素,并且可以使用表格,那么值得一看。
...希望它有所帮助。
There are lots of jQuery plug ins that provide paging functionality.
jQuery Pagination Plug ins[^]
A nice grid based plug in, that offers pagination features is DataTables[^]. If you're not constraining yourself to paging div elements, and can use a table, this is worth a look at.
... hope it helps.
我想传递我从ajax调用成功获得的响应对象,作为onclick函数的参数
I want to pass response object which i got from ajax call success, as an argument to an onclick function
该问题因滥用报告而被关闭,但显然它可以回答。
这里的问题如何是不正确的,这就是为什么:你不能把任何东西传递给这个事件处理程序,因为你不要决定传递给它的是什么。浏览器在用户点击时调用该事件;你永远不会打电话给你的事件处理程序而无法决定传递给它的是什么。
你得到的另一个答案不仅是完全错误,而且也是不切实际的:对象通过外部上下文传递,有时可以完成,但不需要(见下文)并且是一个糟糕的编码实践。
但是,你可以访问单击DOM对象。事件对象始终作为事件处理程序的第一个参数传递。
That question was closed due to abuse reports, but apparently it can be answered.
The question "how to" is incorrect here, here is why: you cannot pass anything to this event handler, because you don't decide what to pass to it. The event is invoked by the browser on user's click; you never call your event handler and cannot decide what to pass to it and what not.
The other answer you got was not only completely wrong, but also impractical: the object passed through outer context, which can be done sometimes, but it not needed (see below) and is a bad coding practice.
However, you can get access to the DOM object clicked. The event object is always passed as the first argument to your event handler.
function myClickHandler(event) {
var domElement = event.target;
//...
}
请请参阅: https://developer.mozilla.org/en-US/docs/Web/API/活动。
这是在多个DOM元素上使用相同事件处理程序的方法。
这篇关于如何使用jquery与使用ajaxcall从asmx页面检索的datalist进行客户端分页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!