String combo

This commit is contained in:
2023-03-13 08:51:51 +06:00
parent b8f655f69b
commit 4aa9eaa9d3
3 changed files with 92 additions and 12 deletions

View File

@ -1,7 +1,7 @@
//Copyright (C) Ivanov I.M. file created in 2008
//For find non english chars: [^\x00-\x7F]+
//Заглушки
//Stubs
function setPropVal(uid,id,c,p){
ERec_mas[uid].setPropVal(id,c,p);
}
@ -321,6 +321,32 @@ class EdtRec
let nList=findNode(nodeProp, "options");
if(nList!=null)
{
if(nList.getAttribute("selector")=="combo")
{
let select = document.createElement('select');
select.classList.add('DBMS');
select.style.cssText="width: 100%; height:22px; line-height: 22px;";
select.setAttribute("name",nodeProp.getAttribute("n"));
select.setAttribute("id","prop_"+this.uid+"_"+nodeProp.getAttribute("n"));
select.onchange = function(thiz,node){ return function()
{
thiz.onComboObjectChangeHandler(node);
};
}(this,nodeProp);
let nCheckbox = nList.firstChild;
while (nCheckbox != null) {
if (nCheckbox.nodeName == "option") {
let option = document.createElement('option');
option.setAttribute("value",nCheckbox.getAttribute("n"));
option.appendChild(document.createTextNode(nCheckbox.getAttribute("d")));
select.appendChild( option );
}
nCheckbox = nCheckbox.nextSibling;
}
//select.setAttribute("value",value);// does not work because when creating no values in the list
newCell1.appendChild(select);
}else{
nodeProp.field = new TCheckboxListField(nodeProp.getAttribute("n"));
let nCheckbox = nList.firstChild;
while (nCheckbox != null) {
@ -330,6 +356,7 @@ class EdtRec
nCheckbox = nCheckbox.nextSibling;
}
newCell1.appendChild(nodeProp.field.getDiv());
}
}else
{
let input = document.createElement('input');
@ -958,7 +985,7 @@ class EdtRec
let rec=new SRec();
rec.opener=this;
rec.create();
rec.create(null);
rec.f_State=1;
rec.f_PropName=nodeProp.getAttribute("n");
rec.f_Settings=settings;

View File

@ -541,7 +541,7 @@ class SRec
let td,tr,td1,td2;
let nodeFilter=null;
let tablefilter=document.getElementById('idfilter'+this.uid);
if (tablefilter.tBodies==null) alert2(trt('Alert'),'tablefilter=null');
if (tablefilter==null || tablefilter.tBodies==null) alert2(trt('Alert'),'tablefilter=null');
let nodeType=findFirstNode(node, "type");
this.f_pI=nodeType.getAttribute("ins");//access rights
this.f_pU=nodeType.getAttribute("upd");
@ -1411,7 +1411,7 @@ class SRec
}
let rec=new SRec();
rec.opener=this;
rec.create();
rec.create(null);
//rec.f_State=1; TODO then finish the job
//rec.f_PropName=nodeColu.getAttribute("n");
rec.f_Settings=settings;
@ -1444,7 +1444,7 @@ class SRec
//Settings.add(0,xmlString)
//wishWin = window.open("showrecord.html?name="+typeName,typeName,"width=800,height=600,menubar=no,location=no,resizable=yes,scrollbars=yes");
let rec=new SRec();
rec.create();
rec.create(null);
//rec.f_State=1; not used
//rec.f_PropName=propname; not used
rec.f_Settings=xmlString;

View File

@ -302,6 +302,59 @@ function confirm2(title,smallText,fullText,okFunc,cancelFunc)
return win;
}
//С поле ввода
function prompt2(title,smallText,fieldText,defaultText,okFunc,cancelFunc){
let win=new TWin();
win.BuildGUI(10,10);
win.setCaption(document.createTextNode(title));
let html='\n\
<table cellpadding="0" cellspacing="0" style="width: 100%; height: 100%;">\n\
<tr style="width: 100%;">\n\
<td colspan="3" style="text-align: center; vertical-align: middle; width: 100%;">'+smallText+'</td>\n\
</tr>\n\
<tr style="width: 100%;">\n\
<td colspan="3" style="width: 100%;">'+fieldText+'</td>\n\
</tr>\n\
<tr style="width: 100%;">\n\
<td colspan="3" style="width: 100%;"><textarea rows="5" style="width: 100%;" id="text_'+win.uid+'">'+defaultText+'</textarea></td>\n\
</tr>\n\
<tr style="height: 10px;">\n\
<td style="width: 100%;">&nbsp;</td>\n\
<td><button class="button-secondary" id="'+win.uid+'_ok" style="width: 80px;margin:1px;">'+trt('Ok')+'</button></td>\n\
<td><button class="button-secondary" id="'+win.uid+'_cancel" style="width: 80px;margin:1px;">'+trt('Cancel')+'</button></td>\n\
</tr>\n\
</table>';
win.setContent(html);
let btnO=document.getElementById(win.uid+'_ok');
btnO.focus();
if(btnO!=null){
btnO.onclick=function(win){
return function(){
let text=document.getElementById('text_'+win.uid).value;
win.Close();
if(okFunc!=null) okFunc(text);
};
}(win,okFunc);
}
let btnC=document.getElementById(win.uid+'_cancel');
if(btnC!=null) {
btnC.onclick = function (win) {
return function () {
win.Close();
if(cancelFunc!=null) cancelFunc();
};
}(win,cancelFunc);
}
win.setSize("350px","200px");
win.setCenter();
win.shadow=true;
win.hide(false);
return win;
}
/**
* Добавить событие к объекту
* @param {object} obj Объект