Yahoo YUI DataTable.DataSource,无论如何要简单更新?

发布于 2025-01-06 14:43:23 字数 482 浏览 6 评论 0原文

是否有一种简单的方法可以通过请求更新 DataTable,而不必再次请求整个结果集?

目前我正在这样做:

    // register add modules event
Y.one('#add_modules').on('click', function(e) {

    e.preventDefault();

    table.datasource.load({ 
        request: 'module_id=' + Y.one('#model').get('value') + '&module_count=' + Y.one('#module_count').get('value') + '&array_id=' + <?php echo $pv_array->id; ?>
    }); 
}); 

尽管这会删除任何现有数据并使用请求结果填充表,因为我想简单地“更新”表而不是再次请求整个结果集。

Is there a simple way to update a DataTable through a request rather then having to request the entire result set again?

currently im doing this:

    // register add modules event
Y.one('#add_modules').on('click', function(e) {

    e.preventDefault();

    table.datasource.load({ 
        request: 'module_id=' + Y.one('#model').get('value') + '&module_count=' + Y.one('#module_count').get('value') + '&array_id=' + <?php echo $pv_array->id; ?>
    }); 
}); 

Although this removes any existing data and populates the table with the request result where as i want to simply "update" the table rather then having to request the whole result set again.

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

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

发布评论

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

评论(1

挽手叙旧 2025-01-13 14:43:23

使用 将新记录添加到 RecordSet(recordSet 是 DataTable 数据的存储库) recordSet.add方法

var item = {}; 
      item.module_id =  Y.one('#model').get('value');
      item.module_count = Y.one('#module_count').get('value');
      item.array_id = <?php echo $pv_array->id; ?>;

//get record set
var rs = table.get('recordset');
rs.add(item); 

add a new Record to the RecordSet (recordSet is the repository for DataTable data) using recordSet.add method

var item = {}; 
      item.module_id =  Y.one('#model').get('value');
      item.module_count = Y.one('#module_count').get('value');
      item.array_id = <?php echo $pv_array->id; ?>;

//get record set
var rs = table.get('recordset');
rs.add(item); 
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文