add required in editorFactory and containerFactory

add required in editorFactory and containerFactory
This commit is contained in:
daisyonly 2014-08-26 17:36:37 +08:00
parent 63b5cdf688
commit edb85afd67
1 changed files with 9 additions and 8 deletions

View File

@ -22,9 +22,9 @@ ContainerFactory.prototype.createEditorContainer = function(header, id,
containerInfo[i].name == ""; containerInfo[i].name == "";
} }
if (containerInfo[i].children == null) { if (containerInfo[i].children == null) {
console.log(containerInfo[i]);
this.appendEdtiors(container, containerInfo[i].label, this.appendEdtiors(container, containerInfo[i].label,
containerInfo[i].nameCN, containerInfo[i].name, containerInfo[i].nameCN, containerInfo[i].required, containerInfo[i].name,
containerInfo[i].paramTypeModel,containerInfo[i].value == null ?"":containerInfo[i].value); containerInfo[i].paramTypeModel,containerInfo[i].value == null ?"":containerInfo[i].value);
} else { } else {
$(container).append( $(container).append(
@ -39,29 +39,30 @@ ContainerFactory.prototype.createEditorContainer = function(header, id,
}; };
ContainerFactory.prototype.appendEdtiors = function(container, label, name, id, ContainerFactory.prototype.appendEdtiors = function(container, label, name, required, id,
editorInfo, value) { editorInfo, value) {
var editorFactory = new EditorFactory(); var editorFactory = new EditorFactory();
if (editorInfo.type.toLowerCase() == "field") { if (editorInfo.type.toLowerCase() == "field") {
console.log("required:"+required);
$(container).append( $(container).append(
editorFactory.createField(label, name, editorInfo.size, id,value)); editorFactory.createField(label, name, required, editorInfo.size, id,value));
} else if (editorInfo.type.toLowerCase() == "nfield") { } else if (editorInfo.type.toLowerCase() == "nfield") {
$(container).append( $(container).append(
editorFactory editorFactory
.createMultiField(label, name, editorInfo.size, id,value)); .createMultiField(label, name, required, editorInfo.size, id,value));
} else if (editorInfo.type.toLowerCase() == "table") { } else if (editorInfo.type.toLowerCase() == "table") {
$(container).append( $(container).append(
editorFactory.createTable(label, name, editorInfo.cols, id,value)); editorFactory.createTable(label, name, required, editorInfo.cols, id,value));
} else if (editorInfo.type.toLowerCase() == "file") { } else if (editorInfo.type.toLowerCase() == "file") {
$(container).append( $(container).append(
editorFactory.createFile(lable, name, editorInfo.size, id,value)); editorFactory.createFile(lable, name, required, editorInfo.size, id,value));
} else if (editorInfo.type.toLowerCase() == "date") { } else if (editorInfo.type.toLowerCase() == "date") {
$(container).append( $(container).append(
editorFactory.createDate(label, name, editorInfo.size, id,value)); editorFactory.createDate(label, name, required, editorInfo.size, id,value));
} else if (editorInfo.type.toLowerCase() == "select") { } else if (editorInfo.type.toLowerCase() == "select") {
$(container).append( $(container).append(
editorFactory.createSelect(label, name, editorInfo.size, editorFactory.createSelect(label, name, editorInfo.size,