Я не смог найти простой пример того, как использовать функцию tableToGrid (или, по крайней мере, я не смог запустить мой образец).
Кто-нибудь может помочь?
Вот мой тест HTML:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script type="text/javascript" src="/Content/Scripts/jquery-1.4.4.js"></script>
<script type="text/javascript" src="/Content/Scripts/jqGrid/jquery.jqGrid.min.js"></script>
<script type="text/javascript" src="/Content/Scripts/jqGrid/grid.locale-en.js"></script>
<script type="text/javascript" src="/Content/Scripts/jqGrid/grid.base.js"></script>
<script type="text/javascript" src="/Content/Scripts/jqGrid/jqDnR.js"></script>
</head>
<body>
<table id="table" class="classname">
<tr><td>bla</td><td>2nd td</td><td>3rd td</td></tr>
<tr><td>bla</td><td>2nd td</td><td>3rd td</td></tr>
<tr><td>bla</td><td>2nd td</td><td>3rd td</td></tr>
<tr><td>bla</td><td>2nd td</td><td>3rd td</td></tr>
</table>
<script type="text/javascript">
// debugger;
// tableToGrid('#classname', {});
$(document).ready(function () { tableToGrid(".table"); });
</script>
</body>
</html>
Обновление: после просмотра примеров (и замены '.' На '#') я добавил несколько элементов в таблицу, и это сработало. Вот исправленный HTML:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<!-- <link rel="stylesheet" href="/Content/Styles/jsTree/style.css" type="text/css" />
<script type="text/javascript" src="/Content/Scripts/jsTree/jquery.cookie.js"></script>
<script type="text/javascript" src="/Content/Scripts/jsTree/jquery.hotkeys.js"></script>
<script type="text/javascript" src="/Content/Scripts/jsTree/jquery.jstree.js"></script>-->
<script type="text/javascript" src="/Content/Scripts/jquery-1.4.4.js"></script>
<script type="text/javascript" src="/Content/Scripts/jqGrid/jquery.jqGrid.min.js"></script>
<script type="text/javascript" src="/Content/Scripts/jqGrid/grid.locale-en.js"></script>
<script type="text/javascript" src="/Content/Scripts/jqGrid/grid.base.js"></script>
<script type="text/javascript" src="/Content/Scripts/jqGrid/jqDnR.js"></script>
</head>
<body>
<input type="button" id="button" />
<table id="table" class="classname" border="1">
<thead>
<tr><th>sdfsdf</th><th>sdfgfdgdf</th><th>sdgfdfsgdfg</th></tr></thead>
<tbody>
<tr><td>bla</td><td>2nd td</td><td>3rd td</td></tr>
<tr><td>bla</td><td>2nd td</td><td>3rd td</td></tr>
<tr><td>bla</td><td>2nd td</td><td>3rd td</td></tr>
<tr><td>bla</td><td>2nd td</td><td>3rd td</td></tr>
</tbody>
</table>
<script type="text/javascript">
// $("#button").click(function () { tableToGrid("#table"); });
//$("#button").click(function () { tableToGrid("#table"); });
$(document).ready(function () { tableToGrid("#table"); });
</script>
</body>
</html>