我正在尝试更新 GetOrgChart 中的元素,为此我正在执行以下操作
html
<form id="one">
<input type="text" name="aaa">
<input type="text" name="bbb">
<input type="submit" name='submitform' value="submit">
</form>
<br>
<div id="people"></div>
JavaScript
var oneForm = $("#one");
$("#people").getOrgChart({
clickEvent: function( sender, args ) {
alert('args.id value outside validate '+args.id);
oneForm.show();
oneForm.validate({
// to add new area for team
rules: {
aaa: {
required: true,
minlength: 3
},
bbb: {
required: true,
minlength: 3
}
},
submitHandler: function (form) {
alert('args.id value inside validate '+args.id);
oneForm.hide();
return false;
}
})
//return false; //if you want to cancel the event
},
primaryColumns: ["Name", "Type"],
linkType: "M",
editable: false,
zoomable: false,
movable: true,
gridView: true,
dataSource: [
{ id: 1, parentId: -1, Name: "Amber McKenzie", Title: "CEO", Address: "MyAddress"},
{ id: 2, parentId: 1, Name: "Ava Field", Title: "CTO", Phone: "+359 888 888 888"},
{ id: 3, parentId: 1, Name: "Evie Johnson", Title: "CFO", Car: "BMW"}]
});
现在只需单击图表元素,然后提交表单,您将看到
第一次点击后args.id
不改变函数的值validate