using code with table

MAboudi
2007-11-17
2013-04-16
  • MAboudi
    MAboudi
    2007-11-17

    hello, thanx for this new release.
    i want to know if i can acces detail rows from a master table (from code).
    and if possible a list of all event that i can use from code(of table).

     
    • Hi,

      form code table you have a global object thisTable this is some methods:

      thisTable.getValue(<Column Name>)  //return value of column the for current row
      thisTable.getSubTable(<SubTable Name>) //return SubTable
      thisTable.getSubTable(<SubTable Name>).getValue(<row>,<Column Name>) //return value of the column for row
      thisTable.getSubTable(<SubTable Name>).getRowCount() //return number of rows

      for other methods you can see the java source the class dataweb.datastore.Table

      this is a list of event:
      beforeEdit(e){} //this automatically called before edit row. Tipically used to check if row is editable.
      afterEdit(e){}
                        e.getTable() // return table

      beforeAddNew(e){} //this automatically called before add new row. Tipically used to check if can add row.
      afterAddNew(e){}
                        e.getTable() // return table

      beforeSetValue(e){} this automatically called before a column setting value. Tipically used to check value.
      afterSetValue(e){} this automatically called after a column setting value.
                         e.getTable() // return table
                         e.getColumName() // return column name
                         e.getValue() // return column value

      beforeUpdate(e){} //this automatically called before update row. Tipically used to check if row is valid.
      afterUpdate(e){}
                       e.getTable() // return table

      this is a transaction event called when database storing data:

      beforeBeginTransaction(e){}
      afterBeginTransaction(e){}
      beforeInsertTransaction(e){} //Insert row
      afterInsertTransaction(e){} //Insert row
      beforeUpdateTransaction(e){} //Update row
      afterUpdateTransaction(e){} //Update row
      beforeDeleteTransaction(e){} //Remove row
      afterDeleteTransaction(e){} //Remove row
      beforeCommitTransaction(e){}
      afterCommitTransaction(e){}
      afterRoolbackTransaction(e){}

      If you use table with subtable these events run only from code of root table for ex:

      beforeSetValue(e){
        if (e.getTable()==thisTable){
           //beforeSetValue of root table
           ....
        }else if (e.getTable()==thisTable.getSubTable(<SubTable Name>)){
           //beforeSetValue of sub-table <SubTable Name>
           ....
        }
      }

      For any question please submit new post 
      Thank you 
      Danilo Limatola