YUI JSON Datatable:如何动态更改请求而不使用 POST

发布于 2024-08-04 07:38:40 字数 408 浏览 3 评论 0原文

我一直在使用 YUI DataTable 进行服务器端排序/分页,一切都按预期工作。

我希望能够有一个类似表单输入元素的东西来限制表中的行,并且我的 json 代理可以处理它,例如:

new YAHOO.util.DataSource("/php/json_proxy.php?")

将返回所有内容,而

new YAHOO.util.DataSource("/php/json_proxy.php?var=blah")

将其限制为仅列 var 等于“blah”的行' 出现。

我怎样才能在没有 HTML POST(页面刷新)的情况下做到这一点,即通过选择框、复选框等更改数据源的请求字符串。

如果您无法遵循,我很抱歉!

I have been playing with server side sorting/paging using YUI DataTable, and everything is working as expected.

I want to be able to have something like a form input element to restrict the rows in the table, and my json proxy can handle it, for example:

new YAHOO.util.DataSource("/php/json_proxy.php?")

will return everything, whereas

new YAHOO.util.DataSource("/php/json_proxy.php?var=blah")

will restrict it to only rows with the column var equalling 'blah' show up.

How can I do this without a HTML POST (refresh of the page), i.e. make changes to the datasource's request string via things like a select box, checkbox etc.

Sorry if you can't follow!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

话少情深 2024-08-11 07:38:40

您应该能够通过以下方式完成此操作(假设 myDataTable 引用您的数据表。

// Sends a request to the DataSource for more data
var oCallback = {
    success : myDataTable.onDataReturnInitializeTable,
    failure : myDataTable.onDataReturnAppendRows,
    scope : myDataTable
};
this.myDataSource.sendRequest("var=blah", oCallback);

有关 数据检索 有很多关于此的信息,其中有一整节是关于在运行时检索数据的。

You should be able to accomplish this with the following (assuming myDataTable references your datatable.

// Sends a request to the DataSource for more data
var oCallback = {
    success : myDataTable.onDataReturnInitializeTable,
    failure : myDataTable.onDataReturnAppendRows,
    scope : myDataTable
};
this.myDataSource.sendRequest("var=blah", oCallback);

The section about data retrieval on YUI has a lot of information about this. There's a whole section about retrieving data at runtime.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文