JSGrid Custom Editing Row Incorrect
HTML
<link rel="stylesheet" href="https://code.jquery.com/ui/1.10.4/themes/redmond/jquery-ui.css">
<script src="https://code.jquery.com/ui/1.11.2/jquery-ui.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jsgrid/1.5.1/jsgrid.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jsgrid/1.5.1/jsgrid-theme.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jsgrid/1.5.3/jsgrid.js"></script>
<div id="jsGrid"></div>
CSS
.jsgrid-cell {
overflow: hidden;
}
.jsgrid-pager { text-align: center; }
JavaScript
var data = [
{
"Name": "Test Test",
"Married": false
},
{
"Name": "Connor Johnston",
"Married": false
},
{
"Name": "Lacey Hess",
"Married": false
},
{
"Name": "Timothy Henson",
"Married": false
}
];
$("#jsGrid").jsGrid({
height: 300,
width: "100%",
autoload: true,
editing: true,
controller: {
loadData: function() {
return data;
}
},
editRowRenderer: function(item, itemIndex) {
var $nameEditor = $("<input>").attr("type", "text").attr("readOnly", "true").val(item.Name);
var $controlButtons = this.option("fields")[1].editTemplate("", item);
return $("<tr>").attr("class", "jsgrid-edit-row")
.append($("<td>").attr("class", "jsgrid-edit-row").append($nameEditor))
.append($controlButtons);
},
fields: [
{ name: "Name", title:"Name", type: "text", width: "60%", validate: "required" },
{ type: "control", width: "10%" }
]
});