qtip2弹出窗口中的jQuery数据表 [英] jQuery datatables in qtip2 popup

查看:188
本文介绍了qtip2弹出窗口中的jQuery数据表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在qtip2弹出窗口中插入jQuery数据表。
我做了这个测试:
http://jsfiddle.net/fDavN/5588/

I would like to insert the jQuery datatables table in a qtip2 popup. I did this test: http://jsfiddle.net/fDavN/5588/

但搜索和分页未显示。

$(document).ready(function() {

    $('.btn-layer').each(function() {    
    $(this).qtip( {
        content: {
            text: 'Loading...',            
            title: {
                text: 'User',
                button: true
            },
            ajax: {
                url: '/echo/json/',
                type: 'GET',
                dataType: 'text',
                cache: false,                
                //dataType: 'json',
                //contentType: 'application/json; charset=utf-8',
                //dataType: 'json',
                //data: { id: c_id },
                success: function(data) {
                    //var data = eval('(' + data + ')');                                        
                    data = testJson;                    
                    var $tab = $('<table class="table table-striped table-bordered dataTable" id="tbl1"></table>');                                                               
                    $($tab).dataTable({                    
                        "aaData": data.aaData,
                        "aoColumns": data.aoColumns
                    });
                    this.set('content.text', $($tab) );
                },
                error: function (xhr, ajaxOptions, thrownError) {
                    alert('AJAX error!');
                } 
****


});

想法?

谢谢! p>

Thanks!

推荐答案

我使用jquery datatables很多,我想你的问题是你没有添加元素表class =table table-stripe table-bordered dataTableid =tbl1>< / table> 到您的页面。我做了你的代码的更改,但没有时间来测试它。你可以尝试一下。

I use jquery datatables lot and I think you problem is that you didn't add the element <table class="table table-striped table-bordered dataTable" id="tbl1"></table> into your page. I did the change of your code but didn't get time to test it. you can have a try.

success: function(data) {
    //var data = eval('(' + data + ')');                                        
    data = testJson;                    

    $('<table class="table table-striped table-bordered dataTable" id="tbl1"></table>').appendTo('body').dataTable({                    
        "aaData": data.aaData,
        "aoColumns": data.aoColumns
    });
    this.set('content.text', $($tab) );
},

这篇关于qtip2弹出窗口中的jQuery数据表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆