• l_sort function明细 netsuite列排序


    function l_sort(col,coltype,hier,hiercol,mach,colname,sAlternateSortType)
    154 // this is used in cases where a column needs to be sorted by something different than it's type/value
    155 if(sAlternateSortType != null)
    156 coltype = sAlternateSortType;
    157 var i = 0, node,node2, numRows = 0, rnode, col2 = -1, col2type;
    158 var elems = new Array(), elem, cols;
    159 var dir_up = true, dir_up2;
    160 var ordered_mach = false;
    161 if (mach == '' || mach == null) mach = '';
    162 else if (document.forms[0].elements[mach+'sortidx'] != null)
    163 {
    164 col2 = document.forms[0].elements[mach+'sortidx'].value;
    165 if (col2 == col)
    166 col2 = -1;
    167 else
    168 {
    169 col2type = document.forms[0].elements[mach+'sorttype'].value;
    170 dir_up2 = document.forms[0].elements[mach+'sortdir'].value == "UP";
    171 }
    172 ordered_mach = hasEncodedField(mach,mach+"seqnum");
    173 }
    175 node = l_id(mach+'dir'+col);
    176 if (node.src.indexOf('nlup.gif') != -1)
    177 dir_up = false;
    178 node.src = dir_up ? '/images/nav/nlup.gif' : '/images/nav/nldown.gif';
    179 node2 = l_id(mach+'header');
    180 for (idx=0; idx < node2.cells.length; idx++)
    181 {
    182 if (idx == col)
    183 continue;
    184 node = l_id(mach+'dir'+idx);
    185 if (node != undefined)
    186 node.src = '/images/nav/nlempty.gif';
    187 }
    189 while (true)
    190 {
    191 node = l_id(mach+'row'+i);
    192 if (node != undefined)
    193 {
    194 // when we are sorting by a different type/value than the cell contiains, that value will
    195 // exist in a hidden span - which will always be the first child within the <TD>
    196 if(sAlternateSortType != null)
    197 elem = node.cells[col].firstChild.innerHTML;
    198 else
    199 elem = node.cells[col].innerHTML;
    200 cols = new Array();
    202 for (idx=0; idx < node.cells.length; idx++)
    203 {
    204 cols[idx] = node.cells[idx].innerHTML;
    206 if(node.cells[idx].firstChild && node.cells[idx].firstChild.nodeName == 'INPUT' && node.cells[idx].firstChild.type == 'checkbox')
    207 {
    208 // If a checkbox is checked now, but was not checked the last time we drew it, add CHECKED to the input tag
    209 if(node.cells[idx].firstChild.checked && node.cells[idx].innerHTML.indexOf('checked') < 0)
    210 cols[idx] = cols[idx].substring(0,cols[idx].length-1) + ' CHECKED>';
    211 // else if a checkbox is NOT checked, but it was when we drew it, remove CHECKED from the input tag
    212 else if(!node.cells[idx].firstChild.checked && node.cells[idx].innerHTML.indexOf('checked') >= 0)
    213 cols[idx] = cols[idx].substring(0,cols[idx].indexOf('checked')) + '>';
    214 }
    216 }
    219 if (hier)
    220 {
    221 hierfld = l_elem('_hier'+i);
    222 if (hiercol)
    223 elem = hierfld.value;
    224 elems[i] = new l_node(elem.toLowerCase(),cols,coltype,dir_up,hierfld.value);
    225 }
    226 else if (col2 != -1)
    227 elems[i] = new l_node(elem.toLowerCase(),cols,coltype,dir_up,null,node.cells[col2].innerHTML,col2type,dir_up2, ordered_mach ? findEncodedValue(mach, mach+"seqnum", i+1) : -1);
    228 else
    229 elems[i] = new l_node(elem.toLowerCase(),cols,coltype,dir_up,null,null,null,null,ordered_mach ? findEncodedValue(mach, mach+"seqnum", i+1) : -1);
    230 i++;
    231 }
    232 else
    233 break;
    234 }
    236 numRows = i;
    237 i = 0;
    239 elems.sort(l_sortnodes);
    241 while (i < numRows)
    242 {
    243 node = l_id(mach+'row'+i);
    244 rnode = elems[i];
    245 cols = rnode.row;
    247 for (idx=0; idx < node.cells.length; idx++)
    248 node.cells[idx].innerHTML = cols[idx];
    250 if (hier)
    251 {
    252 hierfld = l_elem('_hier'+i);
    253 hierfld.value = rnode.hier;
    254 }
    255 if (ordered_mach)
    256 setEncodedValue(mach,rnode.linenum,mach+'seqnum',i+1);
    257 i++;
    258 }
    259 l_saveprefs(mach, col, colname, coltype, dir_up);
    262function l_sortprefs(col,coltype,mach,colname)
    264 var dir_up = true;
    265 node = l_id(mach+'dir'+col);
    266 if (node.src.indexOf('nlup.gif') != -1)
    267 dir_up = false;
    268 l_saveprefs(mach, col, colname, coltype, dir_up);
  • 相关阅读:
    Python之Sklearn使用教程
    Centos 查看路径下所有文件中是否包含指定字符
    Centos7x 开启6379端口,Centos7x开启端口
    分享几个ip定位api【转】
    @Scheduled(cron = "* * * * * *")
    QueryRunner的使用
    linux redis重置密码、重启
    nginx里的sticky的作用
    windows环境xampp搭建php电商项目/搭建禅道
    hive中解决中文乱码
  • 原文地址:https://www.cnblogs.com/backuper/p/1305958.html
Copyright © 2020-2023  润新知