ecside增加赋值和取值函数

因工作需要,需要对ecside中的一些不可见的列进行赋值,也取值的需求。对ecside.js的函数进行了扩展

/**用于对 cell进行赋值(用于hidden列)
 * currRow 当前行
 * name 列名
 * sValue:值
 * tableId:表名
 * 作者:yangxp
 * 日期: 20090210
 * */
ECSideUtil.setHiddenPropertyValue=function(currRow, name, sValue,tableId)
{

 if(arguments.length>3 && tableId !=undefined && tableId !="" )
 {
    ECSideUtil.tableId = tableId;
 }
 var theadName = ECSideUtil.tableId+"_table_head";
 var thead = document.getElementById(theadName);
 var cellIndex = -1;
 var flag = false;
 if(thead !=null)
 {
  var cells = thead.rows[0].cells;
  for(var i=0; i<cells.length; i++)
  {
     if(cells[i].getAttribute("columnname")!=null)
     {
        if(ECSideUtil.trimString(cells[i].getAttribute("columnname")) == ECSideUtil.trimString(name))
        {
           cellIndex = cells[i].cellIndex;
           ECSideUtil.updateCell(currRow.cells[cellIndex]);
           currRow.cells[cellIndex].setAttribute("cellValue",sValue);
           currRow.setAttribute("edited","true");
           flag = true;
           break;
        }
     }
  }
 }
 if(!flag)
 {
    alert("setPropertyValue设计属性出错,请检查列名是否正确!");
    return;
 }
}
/**给编辑的Cell赋值innerText (用于显示列)
 * editCell 编辑的INPUT
 * currRow 当前行
 * name 要赋值的列名
 * sValue 赋的值
 * tableId 表名
 * 作者:yangxp
 * 日期:20090210
 * */
ECSideUtil.setUpdatePropertyValue=function(editCell,currRow,name,sValue)
{
    editCell.innerText = sValue;
    ECSideUtil.updateEditCell(editCell);
}
/**往编辑的Cell中插入数据** (用于新增列)
 * currRow 当前行
 * name:列名
 * sValue 值
 * 作者:yangxp
 * 日期:20090210
 * */
ECSideUtil.setInsertProperty=function(currRow,name,sValue)
{
 var cells = currRow.cells;
   var flag = false;
   for(var i=0; i<cells.length; i++)
   {
     if(cells[i].innerHTML.indexOf("name="+name)>0)
     {
        cells[i].childNodes[0].innerText = sValue;
        flag = true;
        break;
     }
   }
   if(!flag)
   {
       alert("setInsertProperty()函数设置属性出错,请检查列名是否正确!");
    return;
   }
}
/**得到某列的值
 * currRow 当前行
 * naem:列名
 * tableId :表名
 * 日期:20090210
 */
ECSideUtil.getProperty=function(currRow, name,tableId)
{
  
    if(arguments.length>3 && tableId !=undefined && tableId !="")
    {
     ECSideUtil.tableId = tableId;
    }
    var theadName = ECSideUtil.tableId+"_table_head";
 var thead = document.getElementById(theadName);
 var cellIndex = -1;
 var flag = false;
 if(thead !=null)
 {
  var cells = thead.rows[0].cells;
  for(var i=0; i<cells.length; i++)
  {
     if(cells[i].getAttribute("columnname")!=null)
     {
        if(ECSideUtil.trimString(cells[i].getAttribute("columnname")) == ECSideUtil.trimString(name))
        {
           cellIndex = cells[i].cellIndex;
           var ss = currRow.cells[cellIndex].innerText;
           flag = true;
           break;
        }
     }
  }
 }
 if(!flag)
 {
    alert("getPropertyValue出错,请检查列名是否正确!");
    return;
 }
 return ss;
   
}
/**
 * 行上移
 * 日期:20090217
 */
ECSideUtil.MoveUp=function(currRow)
{
 var index = currRow.rowIndex
 var tb = currRow.parentNode.parentNode;
      if(index!=0)  
     {  
            tb.moveRow(index,index-1);            
     }else
     {  
         alert("已经是最上面了")  
     }  

}
/**
 * 往下移动行
 * @param {} currRow
 * 日期:20090219
 */
ECSideUtil.MoveDown=function(currRow)
{
 var index = currRow.rowIndex
 var tb = currRow.parentNode.parentNode;
    if(index!=tb.rows.length-1)  
            {  
                tb.moveRow(index,index+1);        
            }else
            {  
             alert("已经是最下面了")  
            }        

}

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值