单击事件后如何为数据表设置空消息>

时间:2015-09-07 06:20:13

标签: jquery datatables

我正在使用jquery数据表来显示从服务器获取的数据。有时候没有可用于显示给定请求的记录,所以在这种情况下我想显示消息:

"Records are not available for your request".

最初使用的是:

"language" : {"emptyTable" : "Records are not available for your request"}

问题在于它是默认消息,我想设置默认消息

"No data in table"

如果记录不可用,则消息应为

"Records are not available for your request".

那么如何为我的数据表设置这两种消息

1 个答案:

答案 0 :(得分:0)

为什么你不创建像:

这样的HTML
 <table style="width: 100%; padding-top: 15px" cellspacing="0" cellpadding="0">
                                        <tbody>
                                            <tr>
                                                <td>
                                                    <div>
                                                        <table cellspacing="0" cellpadding="3" rules="cols" border="1" style="border-color: #71A8D2; border-width: 1px; border-style: Solid; width: 100%; border-collapse: collapse;">
                                                            <tbody>
                                                                <tr class="common" align="center" style="height: 100px;">
                                                                    <td colspan="8">Records are not available for your request.</td>
                                                                </tr>
                                                            </tbody>
                                                        </table>
                                                    </div>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td align="center" valign="top" style="height: 100%; padding-bottom: 15px;">&nbsp;
                                                            &nbsp;
                                                            &nbsp;

                                                </td>
                                            </tr>
                                        </tbody>
                                    </table>

默认显示应为none。如果Datatable为null,则显示此表并隐藏主表。