可以通过自举模态窗口进行数据 [英] Datatable with bootstrap modal window
问题描述
我有两个页面...两者都具有相同的表格内容...唯一的区别在于其内容加载技术。
I have two pages...both are having same table content...the only difference is in their content loading technique..
1) http://myraipur.com/SuprError/Test2.php
这里的datatable内容是由简单的Tr和Td。模式窗口正常工作。
1) http://myraipur.com/SuprError/Test2.php Here the datatable content is loaded by simple "Tr" and "Td". Modal window is working properly.
2) http: //myraipur.com/SuprError/Test1.php
这里的datatable内容是通过延迟加载加载的。模式窗口不起作用。
2) http://myraipur.com/SuprError/Test1.php Here the datatable content is loaded via deferred loading. The modal window is not working.
你可以帮助我吗?
推荐答案
当您的延期完成而不是准备好文档时,您需要运行此代码:
You need to run this code when your deferred is finished instead of document ready:
$("a[data-toggle=modal]").click(function (e) {
lv_target = $(this).attr('data-target');
lv_url = $(this).attr('href');
$(lv_target).load(lv_url);
});
顺便说一句,我强烈推荐使用类似 Knockout 你正在做什么您当前的代码将不容易维护。
By the way, I can highly recommend using something like Knockout for what you're doing. Your current code won't be easy to maintain.
这篇关于可以通过自举模态窗口进行数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!