jQuery UI主题在datatables插件中(jQuery UI theming within datatables plugin)
我正在使用jquery datatables插件并在表格页脚中添加了一些自定义jquery-ui按钮。 要使用带有jquery-ui的datatables插件,必须打开“bJQueryUI”选项。
到目前为止没有问题,但现在我将jquery-ui themeroller添加到了我的页面。
当我更改主题时,所有jquery-ui组件都会相应地更改其样式,就像数据表一样,除了数据表中的按钮。
我发现它实际上是一个css优先级问题:themeroller应用的新样式的优先级低于原始样式,因此这些按钮永远不会改变它们的外观。
由于jquery-ui组件和datatables插件都很受欢迎,我以为我会找到有类似问题的人,但到目前为止没有运气...
这就是如何完成数据表的初始化和自定义按钮的创建:
<table id="DataTable"> // ... </table> <script type="text/javascript"> $(function () { var oDataTable = $('#DataTable').dataTable({ "aaData": result.aaData, "bPaginate": false, "bJQueryUI": true, "bInfo": true, "sDom": '<"fg-toolbar ui-toolbar ui-widget-header ui-corner-tl ui-corner-tr ui-helper-clearfix"lfr>t<"fg-toolbar ui-toolbar ui-widget-header ui-corner-bl ui-corner-br ui-helper-clearfix"ipT<"toolbar">>', "oTableTools": { "sRowSelect": "single" } }); // add buttons $("div.toolbar").html('<button id="AddButton">New element</button>'); $("#AddButton").button().click(function () { /* ... */ }); // add more buttons... } </script>
这是实际html结构和应用的css样式的屏幕截图: http : //i.stack.imgur.com/vbAuy.jpg
非常感谢任何提示。
I'm using the jquery datatables plugin and added some custom jquery-ui buttons to the table footer. To use the datatables plugin with jquery-ui theming the "bJQueryUI" option has to be turned on.
So far no problem, but now I added the jquery-ui themeroller to my page.
When I change the theme, all the jquery-ui components change their style accordingly, just like the datatable, except for the buttons within the datatable.
I found out that it actually is a css-priority issue: the new styles applied by the themeroller got lower priority than the original styles, so these buttons never change their look.
As the jquery-ui components and the datatables plugin both are quite popular I thought I would find someone with similar problems, but had no luck so far..
That's how the initialization of the datatable and the creation of the custom buttons are done:
<table id="DataTable"> // ... </table> <script type="text/javascript"> $(function () { var oDataTable = $('#DataTable').dataTable({ "aaData": result.aaData, "bPaginate": false, "bJQueryUI": true, "bInfo": true, "sDom": '<"fg-toolbar ui-toolbar ui-widget-header ui-corner-tl ui-corner-tr ui-helper-clearfix"lfr>t<"fg-toolbar ui-toolbar ui-widget-header ui-corner-bl ui-corner-br ui-helper-clearfix"ipT<"toolbar">>', "oTableTools": { "sRowSelect": "single" } }); // add buttons $("div.toolbar").html('<button id="AddButton">New element</button>'); $("#AddButton").button().click(function () { /* ... */ }); // add more buttons... } </script>
Here's a screenshot of the actual html structure and applied css-styles: http://i.stack.imgur.com/vbAuy.jpg
Any hint is greatly appreciated.
原文:https://stackoverflow.com/questions/6728393
最满意答案
我认为您的计算机与
VT-x/HAXM
技术不兼容,或者您尚未安装。打开Android Sdk管理器。
- 转到
android-sdk
目录并选择tools
文件夹。- 运行
android
文件。- 检查是否安装了
HAXM
如果未安装,请尝试安装并检查是否显示错误对话框,如“您的PC不支持VT-x技术”
如果您正在运行Linux,则需要安装KVM。 在这里您可以找到如何操作的说明: https : //software.intel.com/zh-cn/blogs/2012/03/12/how-to-start-intel-hardware-assisted-virtualization-hypervisor-on- Linux到加速,Intel的Android系统的x86架构模拟器
检查
Hyper-V
是否正在运行(仅限Windows)如果您正在使用Windows,请选中此选项并禁用Hyper-V(如果已启用)
之后尝试再次安装
HAXM/KVM
。希望它有所帮助
I think that your computer is not compatible with
VT-x/HAXM
technology or you haven't already installed.Open your Android Sdk manager.
- Go to your
android-sdk
directory and choosetools
folder.- Run
android
file.- Check if
HAXM
is installedIf it isn't installed try to install and check if it would show error dialog like 'your PC doesn't support VT-x technology'
If you're running Linux, you would need to install KVM. Here you would find instruction how to do it: https://software.intel.com/en-us/blogs/2012/03/12/how-to-start-intel-hardware-assisted-virtualization-hypervisor-on-linux-to-speed-up-intel-android-x86-emulator
Check if
Hyper-V
is running (only Windows)If you're using Windows check this and DISABLE Hyper-V if it is enabled
After that try to install
HAXM/KVM
again.Hope it help
相关问答
更多-
萧山劲松小学新伟业电脑培训中心人民路206号[2023-05-18]
22 -
Android HelloWorld未在AVD中加载,加载所有API样本(Android HelloWorld not loading in AVD, loading all API samples)[2023-09-28]
模拟器上的Honeycomb图像非常慢。 这些3.0平板电脑正在运行Tegra2并且仿真器的性能表明了原因。 除非您需要专门测试Honeycomb的功能,否则我建议您在运行10级或更早版本的仿真器映像上开发和测试您的应用程序。 The Honeycomb image on the emulator is really^4 slow. There's a reason these 3.0 tablets are running a Tegra2 and the performance of the emula ... -
你在Mac上也有这个选项,它与Windows没有什么不同: You have this option on mac too, it's not that different from Windows:
-
您可以使用VirtualBox设置Android虚拟机: http://www.howtogeek.com/164570/how-to-install-android-in-virtualbox/ 并部署到虚拟盒: eclipse中虚拟盒子上的android模拟 我曾经尝试了一段时间,这是一个相当大的性能提升差异。 我有一段时间没有这样做,因为我买了一个非常高端的手机,我现在就用它。 You can setup an Android Virtual Machine using VirtualBox : ht ...
-
重启Eclipse会对你有所帮助! Restarting Eclipse will help you!
-
从Android SDK管理器下载该级别的sdk级别和模拟器。 如果sdk设置正确,只需在命令提示符下键入android ,它就会显示出来。 Download that sdk level and emulators for the level from the Android SDK manager. If the sdk is set up properly, simply type android in the command prompt and it should show up.
-
无法加载api 22的AVD(Can't load AVD of api 22)[2024-01-04]
我认为您的计算机与VT-x/HAXM技术不兼容,或者您尚未安装。 打开Android Sdk管理器。 转到android-sdk目录并选择tools文件夹。 运行android文件。 检查是否安装了HAXM 如果未安装,请尝试安装并检查是否显示错误对话框,如“您的PC不支持VT-x技术” 如果您正在运行Linux,则需要安装KVM。 在这里您可以找到如何操作的说明: https : //software.intel.com/zh-cn/blogs/2012/03/12/how-to-start-intel- ... -
android eclipse avd(android eclipse avd)[2021-05-27]
尝试启动应用程序后,您的模拟器运行了多长时间? Android操作系统可能需要很长时间才能在模拟器中启动。 如果它停留在“ANDROID”屏幕上,那么你要么没有等待足够长的时间,要么你的模拟器出了问题。 它最终应该像设备一样启动到普通的Android锁屏或主屏幕。 您可以在尝试运行应用程序之前启动模拟器,方法是打开Android虚拟设备管理器(Eclipse中的工具栏图标,如果安装正确),然后选择模拟器并单击“开始”按钮。 如果您没有列出任何模拟器,则需要通过单击“新建...”按钮创建一个模拟器。 How ... -
重新安装Windows解决了这个问题。 Reinstallation of Windows solved the problem.
-
Android AVD崩溃了(Android AVD crashes)[2022-11-06]
Android没有正式支持Java 7,尽管在这种情况下这不太可能是你的问题。 我建议选择正常的屏幕分辨率,看看是否有帮助。 我不知道任何具有640x640分辨率的生产设备。 Android does not officially support Java 7, though that unlikely to be your problem in this case. I would recommend choosing a normal screen resolution and see if that ...