diff_report_filter.js

来自「proe5.0野火版下载(中文版免费下载)」· JavaScript 代码 · 共 200 行

JS
200
字号
/*---------------------------------------------------------------------------*\||  Module Details:||  Name:    diff_report_filter.js||  Purpose: handles the filter functionality||  History:||  Date      Release Name  Ver.  Comments|  --------- ------- ----- ----- ----------------------------------------------|  04-Jul-04 K-03-05 Moti   $$1   Moved this code from diff_report.xsl|  05-JUL-04 K-03-05 salex        Added isShowSubModelCB().|  18-Jan-05 K-03-18 Moti   $$2   Fixed javascript error on Reset.|  03-Aug-06 L-01-16 dzel   $$3   Added isShowSubItemRowCB(), onExpandTableRow()||  INSERT COMMENT ABOVE THIS LINE|\*---------------------------------------------------------------------------*//*--------------------------------------------------------------------------*\| Function: isShowRowCB| Purpose:  show lines according to values in check boxes| Input:    table_id   - table unique name|           row        - row index|           data1      - first user data|           data2      - second user data| Output:   | Return:   1 - show row , hide row\*--------------------------------------------------------------------------*/function isShowRowCB ( table_id , row , data1 , data2 ){    var result = 1;    var cbIdName=new Array(4)    cbIdName[0]="checkMetadata"    cbIdName[1]="checkGeometry"    cbIdName[2]="checkDrawing"    cbIdName[3]="checkCosmetic"    var typenum = getTableCellInfo ( table_id , "ChangeTypeNum" , row );    if (typenum.length > 3)    {      var diff_cats = typenum.substr (4);      result = 0;      for (var i = 1; (i < 5) && (result == 0); i++)        if ((diff_cats & (1 << i)) &&            (document.getElementById(cbIdName[i - 1]).checked == true))          result = 1;    }    else if (typenum > 0 && typenum < 5)        result = ( document.getElementById(cbIdName[typenum -1]).checked ==         true ) ? 1 : 0 ;    return result      }/*--------------------------------------------------------------------------*\| Function: isShowSubModelCB | Purpose:  show lines according to value in Sub-Model check box| Input:    table_id   - table unique name|           row        - row index|           data1      - first user data|           data2      - second user data| Output:   | Return:   1 - show row , hide row\*--------------------------------------------------------------------------*/function isShowSubModelCB( table_id , row , data1 , data2 ){    var result = 1;    var modelNum = getTableCellInfo ( table_id , "SubModelNum" , row );    if (modelNum > 1)         result = ( document.getElementById("checkSubModel").checked ==         true ) ? 1 : 0 ;    return result      }/*--------------------------------------------------------------------------*\| Function: onApply| Purpose:  Apply filter was clicked , apply the filter| Input:    | Output:   | Return:   \*--------------------------------------------------------------------------*/function onApply(){    redrawAllTables ()}<!-- ==== turn on all check box and show all lines  ==== -->/*--------------------------------------------------------------------------*\| Function: onReset| Purpose:  reset filter was clicked, turn on all check box and show all lines| Input:    | Output:   | Return:   \*--------------------------------------------------------------------------*/function onReset(){    var cbIdName=new Array(4)    cbIdName[0]="checkMetadata"    cbIdName[1]="checkGeometry"    cbIdName[2]="checkDrawing"    cbIdName[3]="checkCosmetic"    cbIdName[4]="checkSubModel"    var i  = 0;    for (i = 0 ; i <  5 ; i++)     {        var cb = document.getElementById(cbIdName[i]);        if ( cb != null )            cb.checked = true;    }    redrawAllTables ()}/*--------------------------------------------------------------------------*\| Function: isShowSubItemRowCB | Purpose:  show lines according to value in RowIsHidden column| Input:    table_id   - table unique name|           row        - row index|           data1      - first user data|           data2      - second user data| Output:   | Return:   1 - show row , hide row\*--------------------------------------------------------------------------*/function isShowSubItemRowCB (table_id , row , data1 , data2){  var  result = 1;  if (getTableCellInfo (table_id, "RowIsHidden", row) == 1)    result = 0;  return result;}/*--------------------------------------------------------------------------*\| Function: onExpandTableRow  Purpose:  Expand or Collaps this row was clicked.| Input:    | Output:   | Return:   \*--------------------------------------------------------------------------*/function onExpandTableRow (this_row_id, table_id){  var   cur_state = '';  var   i = 0, key_length = this_row_id.length;  var   child_arr = new Array(0);  for (var row_id = ''; row_id != null; i++)  {    row_id = getTableCellInfo (table_id , "HierarchicalRowId", i);    if (row_id == this_row_id)    {      var  cell_text = getTableCellInfo (table_id , "Item_Type", i);      var  new_cell_text = cell_text;      cur_state = getTableCellInfo (table_id , "RowIsExpanded", i);      if (cur_state == 'Expanded')      {        setTableCellInfo (table_id , "RowIsExpanded", i, 'Collapsed');        new_cell_text = cell_text.replace ('downarrow.gif', 'horzarrow.gif');      }      else if (cur_state == 'Collapsed')      {        setTableCellInfo (table_id , "RowIsExpanded", i, 'Expanded');        new_cell_text = cell_text.replace ('horzarrow.gif', 'downarrow.gif');      }      setTableCellInfo (table_id , "Item_Type", i, new_cell_text);    }    else if ((row_id != null) && (row_id.substr(0, key_length) == this_row_id))      child_arr.push(i);  }  for (i = 0; i < child_arr.length; i++)  {    if (cur_state == 'Expanded')      setTableCellInfo (table_id , "RowIsHidden", child_arr[i], '1');    else      setTableCellInfo (table_id , "RowIsHidden", child_arr[i], '0');  }  redrawAllTables ()}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?