Skip to content

Commit 486e28f

Browse files
committed
增加 jquery datables tooltip示例。
1 parent 7b973bb commit 486e28f

21 files changed

+33421
-0
lines changed

YanZhiwei.JavaScript.Utilities/YanZhiwei.JavaScript.Utilities.csproj

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,24 @@
542542
<Content Include="jquery\datatables\1.10.2\plugins\bootstrap\dataTables.bootstrap-rtl.css" />
543543
<Content Include="jquery\datatables\1.10.2\plugins\bootstrap\dataTables.bootstrap.css" />
544544
<Content Include="jquery\datatables\1.10.2\plugins\bootstrap\dataTables.bootstrap.js" />
545+
<Content Include="jquery\jquery-ui-1.12.0\AUTHORS.txt" />
546+
<Content Include="jquery\jquery-ui-1.12.0\external\jquery\jquery.js" />
547+
<Content Include="jquery\jquery-ui-1.12.0\images\ui-icons_444444_256x240.png" />
548+
<Content Include="jquery\jquery-ui-1.12.0\images\ui-icons_555555_256x240.png" />
549+
<Content Include="jquery\jquery-ui-1.12.0\images\ui-icons_777620_256x240.png" />
550+
<Content Include="jquery\jquery-ui-1.12.0\images\ui-icons_777777_256x240.png" />
551+
<Content Include="jquery\jquery-ui-1.12.0\images\ui-icons_cc0000_256x240.png" />
552+
<Content Include="jquery\jquery-ui-1.12.0\images\ui-icons_ffffff_256x240.png" />
553+
<Content Include="jquery\jquery-ui-1.12.0\index.html" />
554+
<Content Include="jquery\jquery-ui-1.12.0\jquery-ui.css" />
555+
<Content Include="jquery\jquery-ui-1.12.0\jquery-ui.js" />
556+
<Content Include="jquery\jquery-ui-1.12.0\jquery-ui.min.css" />
557+
<Content Include="jquery\jquery-ui-1.12.0\jquery-ui.min.js" />
558+
<Content Include="jquery\jquery-ui-1.12.0\jquery-ui.structure.css" />
559+
<Content Include="jquery\jquery-ui-1.12.0\jquery-ui.structure.min.css" />
560+
<Content Include="jquery\jquery-ui-1.12.0\jquery-ui.theme.css" />
561+
<Content Include="jquery\jquery-ui-1.12.0\jquery-ui.theme.min.css" />
562+
<Content Include="jquery\jquery-ui-1.12.0\LICENSE.txt" />
545563
<Content Include="jquery\zTree\3.5\zTree_example1.aspx" />
546564
<Content Include="jqUtilsDemo.aspx" />
547565
<Content Include="JsDemo.aspx" />
@@ -1380,6 +1398,7 @@
13801398
<Content Include="jquery\jquery-1.9.1.min.map" />
13811399
<Content Include="store.js\Changelog" />
13821400
<Content Include="store.js\LICENSE" />
1401+
<Content Include="jquery\jquery-ui-1.12.0\package.json" />
13831402
<None Include="Web.Debug.config">
13841403
<DependentUpon>Web.config</DependentUpon>
13851404
</None>

YanZhiwei.JavaScript.Utilities/jquery/datatables/1.10.2/datatables.html

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
55
<title>datatables 1.10.2</title>
66
<link href="media/css/jquery.dataTables.css" rel="stylesheet" />
7+
<link href="../../jquery-ui-1.12.0/jquery-ui.min.css" rel="stylesheet" />
78
<script src="../../../jsUtils.js" type="text/javascript"></script>
89
<script src="../../jquery-1.9.1.js" type="text/javascript"></script>
10+
<script src="../../jquery-ui-1.12.0/jquery-ui.min.js"></script>
911
<script src="../../../jqUtils.js" type="text/javascript"></script>
1012
<script src="media/js/jquery.dataTables.js" type="text/javascript"></script>
1113
<script src="datatablesUtils.js" type="text/javascript"></script>
@@ -50,6 +52,7 @@
5052
{ "time": "2015-10-12", "log": "test", "status": "正常" },
5153
{ "time": "2015-10-13", "log": "test", "status": "正常" }
5254
];
55+
5356
$('#tableLog').dataTable().addJson(_jsonObj);
5457

5558
//var _jsonString = JSON.stringify(_jsonObj);
@@ -113,6 +116,12 @@
113116
var _rowIndex = table.getRowIndexByParam('time', '2015-10-13');
114117
if (_rowIndex >= 0) {
115118
table.updateRowByIndex(_rowIndex, { "time": "2015-10-22", "log": "test", "status": "不正常" });
119+
var oTable = $('#tableLog').dataTable();
120+
oTable.$('tr').tooltip({
121+
"delay": 0,
122+
"track": true,
123+
"fade": 250
124+
});
116125
}
117126
}
118127
function getRowHtmlByParam() {
@@ -124,6 +133,25 @@
124133
$(_row).css("background-color", "green");
125134
}, 2000);
126135
}
136+
function addRowTooltip() {
137+
$('#tableLog tbody tr').each(function () {
138+
139+
var sTitle;
140+
141+
var nTds = $('td', this);
142+
var sBrowser = $(nTds[1]).text();
143+
console.log("sBrowser:" + sBrowser);
144+
this.setAttribute('title', sBrowser);
145+
});
146+
147+
var oTable = $('#tableLog').dataTable();
148+
/* Apply the tooltips */
149+
oTable.$('tr').tooltip({
150+
"delay": 0,
151+
"track": true,
152+
"fade": 250
153+
});
154+
}
127155
</script>
128156
</head>
129157
<body>
@@ -144,5 +172,6 @@
144172
<input type="button" value="getRowIndexByParam" onclick="getRowIndexByParam()" />
145173
<input type="button" value="deleteRowByParam" onclick="deleteRowByParam()" />
146174
<input type="button" value="getRowHtmlByParam" onclick="getRowHtmlByParam()" />
175+
<input type="button" value="addRowTooltip" onclick="addRowTooltip()" />
147176
</body>
148177
</html>

0 commit comments

Comments
 (0)