gpt4 book ai didi

forms - 使用 dhtmlxConnector 加载表单数据

转载 作者:行者123 更新时间:2023-12-02 08:24:08 24 4
gpt4 key购买 nike

我用几个控件构建了 dhtmlxForm,其中之一是容器内的 dhtmlxGrid。我需要使用 dhtmlxConnector render_array 加载表单数据,但不知道最好的方法。

var myForm, myGrid;
var formData = [{type: "settings", position: "label-left", inputWidth: 150, labelWidth: 90},{type: "block", name: "buttonBlock", width: 500, list: [{type: "button", name: "btn1", value: "Patrick"},{type: "newcolumn", offsetLeft: 20},{type: "button", name: "btn2", value: "Edgar"},{type: "newcolumn", offsetLeft: 20},{type: "button", name: "btn3", value: "Renee"}]},{type: "block", width: 500, list: [{type: "input", name: "name", label: "Name"},{type: "input", name: "email", label: "E-mail"},{type: "input", name: "age", label: "Age", width: 70},{type: "select", name: "sex", label: "Sex", width: 70, options:[{text: "Male", value: "m"},{text: "Female", value: "f"}]},{type: "container", name: "userList", label: "Ordered items", inputWidth: 330, inputHeight: 200},{type: "hidden", name: "grid"}]}];
// server script name will loaded in “hidden” item with form data
var inProgress = false;
function doOnLoad() {
myForm = new dhtmlXForm("myForm", formData);
myForm.attachEvent("onButtonClick", function(name){
if (name.match(/^btn\d$/) != null && inProgress == false) {
updateForm(name.replace(/btn/,""));
}
});
myGrid = new dhtmlXGridObject(myForm.getContainer("userList"));
myGrid.setSkin("dhx_skyblue");
myGrid.setImagePath("codebase/imgs/");
// 1st load
updateForm(1);
}
function updateForm(index) {
//what is the best way to do it?
}

最佳答案

这似乎正是您需要的方式:

function updateForm(index) {
inProgress = true;
myForm.load("xml/user"+index+".xml", function(){
// reload grid here
myGrid.clearAll();
myGrid.loadXML("xml/"+myForm.getItemValue("grid"), function(){
inProgress = false;
});
});
}

关于forms - 使用 dhtmlxConnector 加载表单数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33808976/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com