当我首先加载我的页面时,表中没有任何内容,并且数据表没有初始化,在添加了几个交互行之后以及添加所有行时(使用ajax调用)我以这种方式初始化数据表:
oTable = $('#table).dataTable( {
"bJQueryUI": true,
"bSortClasses": false,
"sDom":'T<"clear">',
"sPaginationType": "full_numbers",
"sDom": 'T<"clear"><"fg-toolbar ui-widget-header ui-corner-tl ui-corner-tr ui-helper-clearfix"lfr>t<"fg-toolbar ui-widget-header ui-corner-bl ui-corner-br ui-helper-clearfix"ip>'
} );
Run Code Online (Sandbox Code Playgroud)
问题是我希望能够清除该表并继续在html中添加内容,然后在不使用fnAddData的情况下从该源代码重新创建表.
有任何想法吗?
谢谢!
如何在我在数据表中添加的行中添加一个类?
如果不可能,我该如何使用fnRowCallback或fnDrawCallback更改课程?
oTable = $('#example').dataTable( {
"bJQueryUI": true,
"bSortClasses": false,
"sDom":'T<"clear">',
"sPaginationType": "full_numbers",
"sDom": 'T<"clear"><"fg-toolbar ui-widget-header ui-corner-tl ui-corner-tr ui-helper-clearfix"lfr>t<"fg-toolbar ui-widget-header ui-corner-bl ui-corner-br ui-helper-clearfix"ip>',
"fnRowCallback": function( nRow, aData, iDisplayIndex ) {
var oSettings = oTable.fnSettings();
oSettings.aoData[iDisplayIndex].nTr.className = "gradeX odd";
}
});
Run Code Online (Sandbox Code Playgroud)
上面的代码给了我一个错误.
这是我添加行的方式:
oTable.fnAddData(arr);
Run Code Online (Sandbox Code Playgroud) 我在Resources.Designer.cs中添加了一个小函数,它的运行效果很好,问题是当我从Resources.resx中添加或删除某些内容时,此函数总是会被删除,是否有我可以放置的指示符或绕过这个吗?
谢谢!
这是用作索引器的非常简单的方法。
internal static string Keys(string key)
{
return ResourceManager.GetString(key, resourceCulture);
}
Run Code Online (Sandbox Code Playgroud)
之所以这样做,是因为您无法执行Properties.Resources,然后合并一个值。扩展程序可以工作,但是我尝试过并且很花哨,因为它全都是静态方法,您不想实例化。
有想法吗?
我怎样才能在jQuery中做foreach(Directory中的文件文件).
谢谢!