首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >tablesaw用于响应设计的jQuery插件在ajax调用的情况下不起作用

tablesaw用于响应设计的jQuery插件在ajax调用的情况下不起作用
EN

Stack Overflow用户
提问于 2015-10-24 23:44:51
回答 1查看 1.7K关注 0票数 0

我正在使用tablesaw构建一个具有响应式设计的超文本标记语言表格。当我直接在我的php (即Codeigniter )网页中使用代码时,它工作得很好。但是,如果在单击一个按钮(即表单提交)时进行ajax调用,并从该调用中获取响应表的完整HTML,然后将其显示在页面中,则该方法不起作用。它就变成了一个非响应的HTML表。

ajax调用,即表单提交是用jQuery Form plugin完成的

HTML:

代码语言:javascript
复制
<div class="result"></div>

    <form class="form_action" enctype="multipart/form-data" name="form_action" 
method="post" action="<?php echo BASE_URL; ?>index/show_order_details_now">

    <input type="submit" value="Submit" class="btn_submit" name="submit_evoucher" />

    </form>

JS:

代码语言:javascript
复制
 $(form).ajaxSubmit({
      target: '.result', 
      success: function(response) {
       $(".result").html(response);

      }
    });

被调用的函数是:

代码语言:javascript
复制
function show_order_details_now(){

    ?>


    <?php

$orders_paid='  <link  rel="stylesheet" type="text/css" href="'.JSPATH.'tablesaw-master/dist/tablesaw.css"/>

        <table   class="tablesaw purchase_details_tbl_1"  data-tablesaw-mode="columntoggle" ><thead>
                <tr>
                    <th scope="col" data-tablesaw-sortable-col data-tablesaw-priority="1">Invoice No</th>



                    <th scope="col" data-tablesaw-sortable-col data-tablesaw-sortable-default-col data-tablesaw-priority="3">Product Code</th>
                    <th scope="col" data-tablesaw-sortable-col data-tablesaw-priority="persist">Product Name</th>
                    <th scope="col" data-tablesaw-sortable-col data-tablesaw-priority="2">Specification</th>
                    <th scope="col" data-tablesaw-sortable-col data-tablesaw-priority="1">Quantity</th>
                    <th scope="col" data-tablesaw-sortable-col data-tablesaw-priority="2">Rate</th>
                    <th scope="col" data-tablesaw-sortable-col data-tablesaw-priority="4">Sub Total(Tk)</th>
                </tr>
            </thead><tbody>
            <tr>
                <td>1</td>
                <td>2</td>
                <td>3</td>
                <td>4</td>
                <td>5</td>
                <td>6</td>
                <td>7</td>
            </tr>';




            //echo '<br/><b> order iddd = '.$order_id.'</b>';







        $orders_paid.='</tbody></table>';





        echo $orders_paid;



}// end of function show_order_details_now

那么,在这种情况下,如何使表像tablesaw应该做的那样响应呢?

EN

回答 1

Stack Overflow用户

发布于 2015-12-20 13:31:49

只需添加:

代码语言:javascript
复制
jQuery(document).trigger('enhance.tablesaw');

一旦将表插入到DOM中。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/33320041

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档