📄 dtable
字号:
var s = new String(str);
if (whitespace.indexOf(s.charAt(s.length-1)) != -1)
{
var i = s.length - 1;
while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1)
{
i--;
}
s = s.substring(0, i+1);
}
return s;
}
function Trim(str)
{
return RTrim(LTrim(str));
}
function DT_Listfun_SetTDContral(i,ii,isaddnew)
{
var strreadonly=new String();
if((ii<DTable_mincellIndex || ii>DTable_maxcellIndex) && isaddnew!='1')
{
strreadonly=' readonly';
}
else
{
strreadonly='';
}
var strtype='';
var strreturntext=new String();
var strtv= replace(DT_TableText[i][ii].toString(),' ','');
DT_inputBackground=DT_Main_Tab.rows[i].style.Background;
strtv=Trim(strtv);
try
{//DT_Fieldtype6
strtype=eval('DT_Fieldtype' + ii.toString());
}
catch(e)
{
}
if(strtype=='numeric')
{blislistnumeric=true;
var strnumset=eval('DT_Fieldvalue' + ii.toString() + '.split("$$")');
var strms=strnumset[3].toString();
strv=replace(replace(strtv,strms,''),',','');
if(strreadonly=='')
{
strreturntext='<input name=\"nb_' + i.toString() + '_' + ii.toString() + '\" style=\"height:18;width:100%;Background:' + DT_inputBackground + ';border:0;\" ondblclick=\"showjsq(this);\" value=\"' + strv + '\" title=\"点击选择数字\"' + strreadonly + '>';
}
else
{
strreturntext='<input name=\"nb_' + i.toString() + '_' + ii.toString() + '\" style=\"height:18;width:100%;Background:' + DT_inputBackground + ';border:0;\" value=\"' + strv + '\" readonly>';
}
blislistnumeric=true;
}
else if(strtype=='checkbox')
{
var strtmpv1=eval('DT_Fieldvalue' + ii.toString());
var strtxtv=strtmpv1.split("$$");
if(strtv==strtxtv[0])
{
if(strreadonly=='')
{
strreturntext='<input type=\"checkbox\" name=\"ch_' + i.toString() + '_' + ii.toString() + '\" checked value=\"1\" onclick=\"DT_Listfun_EditReCheckBox(\'' + strtxtv[0] + '$$' + strtxtv[1] + '\',\'' + i.toString() + '\',\'' + ii.toString() + '\');\"><span id=\"DT_Edit_CBTEXT_' + i.toString() + '_' + ii.toString() + '\">' + strtv + '</span>';
}
else
{
strreturntext='<input type=\"checkbox\" name=\"ch_' + i.toString() + '_' + ii.toString() + '\" checked value=\"1\" style=\"width=0;height=1;\"><span id=\"DT_Edit_CBTEXT_' + i.toString() + '_' + ii.toString() + '\">' + strtv + '</span>';
}
}
else
{
if(strreadonly=='')
{
strreturntext='<input type=\"checkbox\" name=\"ch_' + i.toString() + '_' + ii.toString() + '\" value=\"1\" onclick=\"DT_Listfun_EditReCheckBox(\'' + strtxtv[0] + '$$' + strtxtv[1] + '\',\'' + i.toString() + '\',\'' + ii.toString() + '\');\"><span id=\"DT_Edit_CBTEXT_' + i.toString() + '_' + ii.toString() + '\">' + strtv + '</span>';
}
else
{
strreturntext='<input type=\"checkbox\" name=\"ch_' + i.toString() + '_' + ii.toString() + '\" value=\"1\" style=\"width=0;height=1;\"><span id=\"DT_Edit_CBTEXT_' + i.toString() + '_' + ii.toString() + '\">' + strtv + '</span>';
}
}
}
else if(strtype=='select')
{
strtv=Trim(replace(strtv,' ',''));
strreturntext=eval('DT_Fieldvalue' + ii.toString());
strreturntext=replace(replace(strreturntext,'<select','<select style=\"Background:' + DT_inputBackground + ';border:0;\" name=\"se_' + i.toString() + '_' + ii.toString() + '\" '),'>' + strtv + '<',' selected>' + strtv + '<');
if(strreadonly!='')
{
strtmpse=strreturntext;
strreturntext=replace(strreturntext,'<select','<select style=\"width:0;height:1;\"');
strreturntext=strreturntext + replace(replace(strtmpse,'se_' + i.toString() + '_' + ii.toString(),'se_' + i.toString() + ii.toString()),'<select','<select disabled');
}
}
else if(strtype=='datetime')
{blislistdatetime=true;
var dtthis=new Date();
if(strtv.length>5)
{
dtthis=DT_Date_Ex(strtv);
}
else
{
dtthis=new Date();
dtthis=DT_Date_Ex(dtthis.getFullYear() + '-' + (parseInt(dtthis.getMonth()) + 1).toString() + '-' + dtthis.getDate().toString());
}
var stry=dtthis.getFullYear().toString();
var strmon=new String(parseInt(dtthis.getMonth()) + 1);
if(strmon.length==1)
{
strmon='0' + strmon;
}
var strdate=dtthis.getDate().toString();
if(strdate.length==1)
{
strdate='0' + strdate;
}
var strhour=dtthis.getHours().toString();
if(strhour.length==1)
{
strhour='0' + strhour;
}
var strminute=dtthis.getMinutes().toString();
if(strminute.length==1)
{
strminute='0' + strminute;
}
var strsecond=dtthis.getSeconds().toString();
if(strsecond.length==1)
{
strsecond='0' + strsecond;
}
if(strreadonly!='')
{
strreturntext='<input name=\"dt_' + i.toString() + '_' + ii.toString() + '\" style=\"height:18;width:100%;Background:' + DT_inputBackground + ';border:0;\" value=\"' + strtv + '\" readonly>';
}
else
{
strreturntext='<input name=\"dt_' + i.toString() + '_' + ii.toString() + '\" style=\"height:18;width:100%;Background:' + DT_inputBackground + ';border:0;\" ondblclick=\"DT_fPopCalendar(this,this,' + stry + ',' + strmon + ',' + strdate + ',' + strhour + ',' + strminute + ',' + strsecond + ');\" value=\"' + strtv + '\" title=\"双击选择日期(时间)\">';
}
blislistdatetime=true;
}
else if(strtype=='text')
{
var strtmp004=eval('DT_Fieldvalue' + ii.toString());
strreturntext='<input name=\"tx_' + i.toString() + '_' + ii.toString() + '\" style=\"height:18;width:100%;Background:' + DT_inputBackground + ';border:0;\" value=\"' + strtv + '\" title=\"' + strtmp004.split('$$')[3].toString() + '\"' + strreadonly + '>';
}
else
{
strreturntext='<input name=\"txt_' + i.toString() + '_' + ii.toString() + '\" style=\"height:18;width:100%;Background:' + DT_inputBackground + ';border:0;\" value=\"' + strtv + '\"' + strreadonly + '>';
}
DT_Main_Tab.rows[i].cells[ii].innerHTML=strreturntext;
}
function DT_Listfun_EditMode()
{
if(DT_Grid_EnableEdt==false)
{
alert('禁止记录更新操作');
DT_info.innerHTML='禁止记录更新..';
}
DT_info.innerHTML='更新模式..';
for(var i=DTable_minrowIndex;i<=DT_Main_Tab.rows.length-1;i++)
{
for(var ii=1;ii<=DT_Main_Tab.rows[DTable_minrowIndex-1].cells.length-1;ii++)
{
if(DT_Main_Tab.rows[i].cells[ii].firstChild!=undefined && DT_Main_Tab.rows[i].cells[ii].firstChild.value!=undefined)
{
}
else
{
DT_Listfun_SetTDContral(i,ii,'0')
}
}
}
DTable_State='edit';
EnableDragCell_init=false;
EnableSort_init=false;
EnableAdjustCellWidth_init=false;
}
function DT_Listfun_clickIt()
{
if(DT_resize_CurState==false && DT_resize_CurDown==false && DT_resize_isre==false)
{
if(event.button==0){
if(document.getElementById('ie5menu')){
document.all.ie5menu.style.left='-1000';}}
event.cancelBubble=true;
var DT_the_obj = event.srcElement;
var DT_the_td;
if(DT_the_obj.tagName.toLowerCase() != 'table' && DT_the_obj.tagName.toLowerCase() != 'tbody' && DT_the_obj.tagName.toLowerCase() != 'tr'){
DT_the_td= DT_get_Element(DT_the_obj,'td');
}
else
{
return;
}
var i = 0 ,j = 0;
if(DT_the_td==null)
{return; }
var DT_the_tr = DT_the_td.parentElement;
var DT_DT_the_table = DT_get_Element(DT_the_td,'table');
var i = 0; DT_Listfun_clearcolor();
DT_cur_row = DT_the_tr.rowIndex;
DT_cur_col = DT_the_td.cellIndex;
if(DT_cur_col==0){return true;}
if(DT_cur_row!=DTable_minrowIndex-1)
{
}
else if(EnableSort_init==true)
{
DT_the_td.mode = !DT_the_td.mode;
if(DT_sort_col!=null)
{
with(DT_thisTable.rows[DTable_minrowIndex-1].cells[DT_sort_col])
{
{
removeChild(lastChild);
}
}
}
with(DT_thisTable.rows[DTable_minrowIndex-1].cells[DT_cur_col])
appendChild(DT_the_td.mode?DT_arrowUp:DT_arrowDown);
DT_Listfun_sorttab(DT_thisTable,DT_cur_col,DT_the_td.mode);
DT_sort_col=DT_cur_col;
}
DT_Listfun_initValue(DTable_minrowIndex);
}
else
{
}
}
function replace(str, fromstring, tostring) {
i = str.indexOf(fromstring);
r = "";
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -