将类传递给所有数据表

时间:2015-11-02 07:30:27

标签: php jquery mysql datatables

我有数据表为我绘制购物清单,其结果来自MySQL数据库。当我转到下一页时,所有类都会被拖放到MySQL数据库中,所以它们可以从一行到另一行不等。

var dataTable = $('#example').dataTable({
    fnDrawCallback : function() {

    }        
});

我知道{I}尝试做的事情需要fnDrawCallback,但不确定会发生什么。

            if(self::Account("donatepoints", Session("userid")) >= $row['cost']) {
                $purchase = '<button class="btn btn-info item"
                data-toggle="modal" 
                data-id="'.$row['itemid'].'"                        
                data-name="'.$row['itemname'].'"
                data-cost="'.$row['cost'].'"
                data-rewardtype = "'.$row['rewardtype'].'"
                data-target="#char-modal">Purchase <i class="fa fa-shopping-cart"></i></button>';
            }
            else { 
            $purchase = '<button class="btn btn-warning donate"
            >Get Points <i class="fa fa-shopping-cart"></i></button>';
            }

是从MySQL数据库中调用的示例。我的Jquery在页面的末尾

 $(".item").click(function(){
     $(".itemname").html($(this).data("name"));
     $("#purchaseform").html("<input type='hidden' name='rewardtype' id='rewardtype' value='" + $(this).data("rewardtype") + "'><input type='hidden' name='itemid' id='itemid' value='" + $(this).data("id") + "'><input type='hidden' name='cost' id='cost' value='" + $(this).data("cost") + "'>");
   });
 $(".donate").click(function() {
     location.href = "/purchase";
 })

因为你可以看到,当用户进入下一页时我不能手动重绘,如果有人有任何想法,我将不胜感激。

0 个答案:

没有答案
相关问题