В xyz
This commit is contained in:
@ -11,11 +11,10 @@ function setFilterVal(uid,id,c,p)
|
||||
|
||||
var SRec_mas = new Array(); //List of all objects "EdtRec" (then something better to think of)
|
||||
|
||||
class SRec extends TWin
|
||||
class SRec
|
||||
{
|
||||
constructor(dialog,path)
|
||||
constructor()
|
||||
{
|
||||
super(dialog,path);
|
||||
this.win=null;
|
||||
this.rwin=null;
|
||||
|
||||
@ -46,19 +45,14 @@ class SRec extends TWin
|
||||
|
||||
this.onUpdate=null; //For call set function
|
||||
this.onInsert=null; //For call set function
|
||||
|
||||
|
||||
//TODO сделать наследование из класса TWin
|
||||
this.parent=null; //родительское окно
|
||||
this.childs=new Array(); //Подчинёные окна
|
||||
}
|
||||
|
||||
|
||||
applyReq(req,fn,node,xmldoc)
|
||||
{
|
||||
this.hideProgressBar();
|
||||
|
||||
if(node.errorCode>0) {
|
||||
alert2(trt('Alert'), node.errorMessage);
|
||||
if(node.error_code>0) {
|
||||
alert2(trt('Alert'), node.error_message);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -156,34 +150,34 @@ class SRec extends TWin
|
||||
|
||||
create(htmlElement)
|
||||
{
|
||||
let str='\
|
||||
<div id="eDiv'+this.uid+'" style="width: 100%; height: 100%; position: relative;">\
|
||||
<table class="SFilter" style="width: 100%; height: 100%;"><tr><td>\
|
||||
<table id="idfilter'+this.uid+'" cellspacing="2" cellpadding="0" style="border: 1px solid rgb(99, 99, 99); table-layout: auto;background-color: var(--row-color-2);" width="100%">\
|
||||
<caption></caption><tbody></tbody>\
|
||||
</table>\
|
||||
</td></tr><tr><td>\
|
||||
<table style="width:100%;"><tr><td><img src="../resources/metadata/dbms/images/rplus.png" alt="add" id="SRec_Add_'+this.uid+'" title="'+trt('Add_record')+'" style="cursor: pointer;"/></td>\
|
||||
<td><img src="../resources/metadata/dbms/images/rdel.png" alt="del" id="SRec_Del_'+this.uid+'" title="'+trt('Delete_record')+'" style="cursor: pointer;"/></td>\
|
||||
<td><img src="../resources/metadata/dbms/images/excel.png" alt="excel" id="SRec_Exc_'+this.uid+'" title="'+trt('Export_to_Excel')+'" style="cursor: pointer;"/></td>\
|
||||
<td style="white-space: nowrap; padding-left: 10px;"><label style="display:none;"><input type="checkbox" id="Selection_'+this.uid+'" checked> '+trt('Selection_mode')+'</label></td>\
|
||||
<td style="width: 99%;"> </td>\
|
||||
<td><img src="../resources/metadata/dbms/images/config.png" alt="'+trt('Settings')+'" id="SRec_Cnf_'+this.uid+'" title="'+trt('Settings')+'" style="cursor: pointer;"/></td>\
|
||||
<td><img src="../resources/metadata/dbms/images/refresh.png" alt="'+trt('Refresh')+'" id="SRec_Rfr_'+this.uid+'" title="'+trt('Update')+'" style="cursor: pointer;"/></td></tr>\
|
||||
</table>\
|
||||
</td></tr><tr><td id="tblContainer_'+this.uid+'" style="vertical-align:top; overflow:hidden; width:100%; height:100%; text-align:center;">\
|
||||
<div id="tblSContainer_'+this.uid+'" style="position: absolute; overflow:scroll; width: 400px; height: 400px;">\
|
||||
<table id="thetable'+this.uid+'" class="SShow">\
|
||||
<caption></caption>\
|
||||
<thead><tr><th></th></tr></thead>\
|
||||
<tbody><tr><td></td></tr></tbody>\
|
||||
</table>\
|
||||
</div>\
|
||||
</td></tr><tr><td>\
|
||||
<center><table id="pages_'+this.uid+'"><tbody><tr><td> </td></tr></tbody></table></center>\
|
||||
</td></tr></table>\
|
||||
</div>\
|
||||
';
|
||||
let str=`
|
||||
<div id="eDiv`+this.uid+`" style="width: 100%; height: 100%; position: relative;">
|
||||
<table class="SFilter" style="width: 100%; height: 100%;"><tr><td>
|
||||
<table id="idfilter`+this.uid+`" cellspacing="2" cellpadding="0" style="border: 1px solid rgb(99, 99, 99); table-layout: auto;background-color: var(--row-color-2);" width="100%">
|
||||
<caption></caption><tbody></tbody>
|
||||
</table>
|
||||
</td></tr><tr><td>
|
||||
<table style="width:100%;"><tr><td><img src="../resources/metadata/dbms/images/rplus.png" alt="add" id="SRec_Add_`+this.uid+`" title="`+trt('Add_record')+`" style="cursor: pointer;"/></td>
|
||||
<td><img src="../resources/metadata/dbms/images/rdel.png" alt="del" id="SRec_Del_`+this.uid+`" title="`+trt('Delete_record')+`" style="cursor: pointer;"/></td>
|
||||
<td><img src="../resources/metadata/dbms/images/excel.png" alt="excel" id="SRec_Exc_`+this.uid+`" title="`+trt('Export_to_Excel')+`" style="cursor: pointer;"/></td>
|
||||
<td style="white-space: nowrap; padding-left: 10px;"><label style="display:none;"><input type="checkbox" id="Selection_`+this.uid+`" checked> `+trt('Selection_mode')+`</label></td>
|
||||
<td style="width: 99%;"> </td>
|
||||
<td><img src="../resources/metadata/dbms/images/config.png" alt="`+trt('Settings')+`" id="SRec_Cnf_`+this.uid+`" title="`+trt('Settings')+`" style="cursor: pointer;"/></td>
|
||||
<td><img src="../resources/metadata/dbms/images/refresh.png" alt="`+trt('Refresh')+`" id="SRec_Rfr_`+this.uid+`" title="`+trt('Update')+`" style="cursor: pointer;"/></td></tr>
|
||||
</table>
|
||||
</td></tr><tr><td id="tblContainer_`+this.uid+`" style="vertical-align:top; overflow:hidden; width:100%; height:100%; text-align:center;">
|
||||
<div id="tblSContainer_`+this.uid+`" style="position: absolute; overflow:scroll; width: 400px; height: 400px;">
|
||||
<table id="thetable`+this.uid+`" class="SShow">
|
||||
<caption></caption>
|
||||
<thead><tr><th></th></tr></thead>
|
||||
<tbody><tr><td></td></tr></tbody>
|
||||
</table>
|
||||
</div>
|
||||
</td></tr><tr><td>
|
||||
<center><table id="pages_`+this.uid+`"><tbody><tr><td> </td></tr></tbody></table></center>
|
||||
</td></tr></table>
|
||||
</div>
|
||||
`;
|
||||
|
||||
if(htmlElement==null || typeof(htmlElement) == "undefined")
|
||||
{
|
||||
@ -829,7 +823,7 @@ class SRec extends TWin
|
||||
{
|
||||
let input = document.createElement('input');
|
||||
input.setAttribute("type","text");
|
||||
button.classList.add('DBMS');
|
||||
input.classList.add('DBMS');
|
||||
input.style.cssText="width: 100%;";
|
||||
input.onkeydown=(e)=>{ if(e==null) e=window.event; if(e.keyCode==13) { this.appendFilter(); this.sendFilter(-1,0); }};
|
||||
input.setAttribute("name",columnNode.getAttribute("n"));
|
||||
@ -1243,7 +1237,7 @@ class SRec extends TWin
|
||||
let tr = document.createElement('tr');
|
||||
tr.onmouseover=function(){ this.style.backgroundColor="var(--btn-color2)"; };
|
||||
tr.onmouseout=function(val1,val2){return function(){val1.style.backgroundColor=val2;}}(tr,bgColor);
|
||||
tr.setAttribute("id",''+id+'_'+this.uid);
|
||||
tr.setAttribute("id",id+'_'+this.uid);
|
||||
tr.style.backgroundColor=bgColor;
|
||||
|
||||
//sequential record number
|
||||
@ -1287,7 +1281,7 @@ class SRec extends TWin
|
||||
else textNode=document.createTextNode("");
|
||||
|
||||
//td.setAttribute("id",id+this.masCL[colN].getAttribute("n")); //so that you can identify each record when you update
|
||||
td.setAttribute("id",""+id+"_"+this.masCL[colN].getAttribute("n")); //so that you can identify each record when you update
|
||||
td.setAttribute("id",id+this.masCL[colN].n); //so that you can identify each record when you update
|
||||
td.appendChild(textNode);
|
||||
//if in the metadata for this column there is a reference object then add a link
|
||||
if (this.masCT[colN]!=null)
|
||||
@ -1449,11 +1443,10 @@ class SRec extends TWin
|
||||
}
|
||||
}
|
||||
|
||||
//Get column number by name, if result=-1 then not find else find
|
||||
//Get column number by name
|
||||
getColN(name){
|
||||
let result=-1;
|
||||
let i=-1;
|
||||
//determine the sequence number of the column
|
||||
let pos=0;
|
||||
let node=findNodeOnPath(this.nodeMetadata,"type/objects-list");
|
||||
let nodeCol = node.firstChild;
|
||||
while (nodeCol != null)
|
||||
@ -1461,14 +1454,13 @@ class SRec extends TWin
|
||||
if(nodeCol.nodeName=="column")
|
||||
{
|
||||
if(nodeCol.getAttribute("n")==name){
|
||||
result=pos;
|
||||
break;
|
||||
}
|
||||
pos++;
|
||||
i++;
|
||||
}
|
||||
nodeCol = nodeCol.nextSibling;
|
||||
}
|
||||
return result;
|
||||
return i;
|
||||
}
|
||||
|
||||
//find the value in the result set by the id of the record and the name of the column
|
||||
@ -1479,7 +1471,7 @@ class SRec extends TWin
|
||||
let pos=this.getColN(col);
|
||||
if(pos>=0){
|
||||
for(let i=0;i<this.f_nodeData.data.length;i++){
|
||||
if(this.f_nodeData.data[i].id==id){
|
||||
if(this.f_nodeData.data[i].id=id){
|
||||
return this.f_nodeData.data[i].row[pos];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user