我必须将 jqgrid 放置在不同的位置,而不是默认的左上角位置。我尝试了一些方法,但它不起作用。我在这里包含了我的代码..请检查一下并给我一个解决方案..
这是html代码:
<div>
<table id="table" style="border-spacing: 7px 7px; margin-left: 5px">
<tr>
<td>
<input style="margin-left: 10px;" type="button" value="Add" id="btn_addusers" />
</td>
</tr>
</table>
<table id="users_grid" style="left: 300px">
</table>
</div>
这是我的 js 代码:
$(document).ready(function() {
$("#btn_addusers").click(function() {
$("#users_grid").clearGridData(true).trigger("reloadGrid");
$("#users_grid").jqGrid({
datatype: "local",
height: 'auto',
width: 'auto',
colNames: ['User ID', 'User Name'],
colModel: [
{ name: 'userid', width: 60 },
{ name: 'username', width: 120 }
],
caption: "Users in Private space"
});
var mydata = [
{ userid: "312171", username: "D, Gnana Xavier" },
{ userid: "311763", username: "Sangeetha" },
{ userid: "312185", username: "Amrutha" },
{ userid: "312186", username: "Ramesh" }
];
for (var i = 0; i <= mydata.length; i++)
$("#users_grid").jqGrid('addRowData', i + 1, mydata[i]);
});
});