Сохранение настроек фильтра при нажатии на ...

This commit is contained in:
2022-01-24 15:38:12 +06:00
parent 6258a39b12
commit d9cd847bb4
6 changed files with 188 additions and 115 deletions

View File

@ -21,9 +21,10 @@ class EdtRec
let eDiv=document.getElementById('eDiv'+this.uid);
eDiv.innerHTML = '<table style="width:100%;height:100%"><tr><td style="vertical-align:middle;background-color:#F1F1F1"><center><IMG src="../resources/metadata/dbms/images/loading.gif"></center></td></tr></table>'
if(caption!='')
this.win.setCaption(document.createTextNode(caption));
this.caption=caption;
if(this.caption!='')
this.win.setCaption(this.caption);
this.win.obj=this;
this.win.hide(false);
@ -85,20 +86,10 @@ class EdtRec
//Задать CDATA значение для узла "type->properties->prop" по "n"
setPropCdata(name,value)
{
let nodeProperties=findNodeOnPath(this.nodeMetadata, 'type/properties');
let nodeProp=nodeProperties.firstChild;
while(nodeProp!=null)
{
if(nodeProp.nodeName=="prop")
{
if(nodeProp.getAttribute("n")==name)
{
getCdata(nodeProp).nodeValue=value;
}
}
nodeProp=nodeProp.nextSibling;
}
let node=findNodeOnPath(this.nodeMetadata,"type/properties/prop[@n='"+name+"']");
if(node!=null) getCdata(node).nodeValue=value;
}
//Задать новое значение GUI полю (не XML, XML выше)
setValue(propName,value){
let field=document.getElementById("prop_"+this.uid+"_"+propName);
@ -162,8 +153,8 @@ class EdtRec
let eTable=document.getElementById('eTable'+this.uid);
let type_name=nodeType.getAttribute("n");
//document.getElementById('caption'+this.uid).appendChild(document.createTextNode(nodeType.getAttribute("d")));
this.win.setCaption(document.createTextNode(nodeType.getAttribute("d")));
if(this.caption === undefined || this.caption=='')
this.win.setCaption(nodeType.getAttribute("d"));
let nodeProperties=findNodeOnPath(this.nodeMetadata, 'type/properties');
this.win.setWidth(nodeProperties.getAttribute("width"));
@ -533,7 +524,11 @@ class EdtRec
button.setAttribute("type","button");
button.setAttribute("value","...");
button.style.cssText="width:30px;font-size:9pt;margin:0px;padding:0px;height:100%;";
button.onclick=function(thiz,val1,val2){return function(){thiz.SelectObjects(val1,val2);};}(this,nodeProp.getAttribute("ot"),nodeProp.getAttribute("n"));
button.onclick=function(thiz,val1,val2){
return function(){
thiz.SelectObjects(val1,val2);
};
}(this,nodeProp.getAttribute("ot"),nodeProp.getAttribute("n"));
newCell2.appendChild(button);
td2.appendChild( table );
@ -925,17 +920,23 @@ class EdtRec
rec.f_State=1;
rec.f_PropName=propname;
rec.f_TypeName=typeName;
rec.win.setLeftTop(pageX-250,pageY-10);
rec.win.setCenter(); //rec.win.setLeftTop(pageX-250,pageY-10);
rec.win.setParent(this.win);
rec.callData(rec.f_TypeName,"");
let settings="";
let node=findNodeOnPath(this.nodeMetadata, "type/properties/prop[@n='"+propname+"']/type");
if(node!=null){
settings=getXMLNodeSerialisation(node);
}
rec.callData(rec.f_TypeName,settings);
/*if(rec.request.callServer(ScriptName,'<?xml version="1.0" encoding="utf-8"?><metadata fn="0"><type n="'+rec.f_TypeName+'"></type></metadata>'))
{
rec.showProgressBar();
}*/
}
//Call the ShowRecord.html window with the parameters for the filter (not just the object name).
//Call the ShowRecord window with the parameters for the filter (not just the object name).
callWindow(nodeProp)
{
let xmlString="";
@ -977,7 +978,7 @@ class EdtRec
rec.showProgressBar();
}
};
//Запросить данные для выпадающих списков и других объектов (только после загрузки данных полей)
callDataSelect()
{
@ -1226,22 +1227,41 @@ class EdtRec
this.hideProgressBar();
}
};
//Request data to fill in the field with the button
setFilterObject(TypeName,prop_id,id)
/**
* Request data to fill in the field with the button
*
* @filter - xml text: filter settings
* @return null
*/
setFilterObject(TypeName, prop_id, id, filter)
{
let node=findFirstNodeOnAttribute(this.nodeMetadata,'prop','n',prop_id);
if(node!==null)
{
getCdata(node).nodeValue=id;
let name=node.getAttribute("FieldCaption");
findNode(node,'#cdata-section').nodeValue=id;
//We request data from the server to fill in the comments on the id of the record.
let prop=document.getElementById("filter_"+prop_id);
let prop=document.getElementById("prop_"+this.uid+"_"+prop_id);
if(prop!==null) prop.value=id;
//Request a comment on the record id from the server
let xml='<?xml version="1.0" encoding="utf-8"?><metadata fn="6"><type n="'+TypeName+'" c="'+name+'" pn="'+prop_id+'" fn="'+name+'">';
xml+='<objects-list><filter><column n="id"><![CDATA['+id+']]></column></filter></objects-list>';
xml+='</type></metadata>';
let xml = '';
if(filter!=''){
//Настройка для последующего вызова формы через кнопку
xml='<prop n="'+prop_id+'"><type n="' + TypeName + '"><objects-list>'+filter+'</objects-list></type></prop>';
applyNodeToNode(CreateXMLDOC(xml).documentElement, node, "n");
//Для запроса списка значений для выпадающего списка
xml = '<?xml version="1.0" encoding="utf-8"?>' +
'<metadata fn="6"><type n="' + TypeName + '" c="' + name + '" pn="' + prop_id + '" fn="' + name + '">' +
'<objects-list>' + filter + '</objects-list>' +
'</type></metadata>';
}else{
xml = '<?xml version="1.0" encoding="utf-8"?>' +
'<metadata fn="6"><type n="' + TypeName + '" c="' + name + '" pn="' + prop_id + '" fn="' + name + '">' +
'<objects-list><filter><column n="id"><![CDATA[' + id + ']]></column></filter></objects-list>' +
'</type></metadata>';
}
if(this.request.callServer(ScriptName,xml,true))
{
this.showProgressBar();
@ -1442,7 +1462,6 @@ class EdtRec
this.showProgressBar();
}
};
//Check the field according to its type
checkData(value,type,maybenull)
{