grovvy question on double click event in IJC form

User 55ffa2f197

23-04-2013 20:51:34

Hi I double click on a cell in IJC form and want to know the value of a column on the clicked row, how do i do that? I know event.row/column gives you the cell you clicked, tried a couple of ways did not work, check the API doc, did not find answer, i might look at wrong place.


Thanks


Dong

User 55ffa2f197

24-04-2013 18:56:02

Hi, after looking at one of my collegues script (done partly by Erin) finally i piece together what i want to accomplish. Want to share with everyone else who might need to do this. After all i waste 4 hours on this. Hope somebody else will not bang their head and waste their time. It is not a rocket science you have just get used to the data model. It all makes sense:


onDoubleClick = { event ->    
    def clickedEntity = event.widget.vertexState.vertex.entity // capture the clicked entity object
    def clickedEdp = clickedEntity.schema.dataProvider.getEntityDataProvider(clickedEntity) //capture clicked entity as a 2D matrix with columns/rows


       def compoundid = clickedEntity.fields.items.find { (it.name).toUpperCase() == 'MOLECULEID' } // find the column/entity you wish to find , say molecules
             
      ids = event.widget.vertexState.selectedRowsIds //capture the row being cliecked
     if (ids.size() != 1) { // works only when single row is selected
      return
     }
     rowId = ids.get(0)
      def getData = clickedEntity.getData([rowId], DFEnvironmentRO.DEV_NULL)
      def molecule = getData[rowId][compoundid.id] //find the molecule string I am looking for
       println molecule       
         }

ChemAxon 99d87cf303

25-04-2013 07:57:55

Hi Dong,


sorry for not getting to this earlier. The way you found is correct. We do not have higher-level publically acessible API (see also https://www.chemaxon.com/forum/viewtopic.php?p=48617)


In 6.0 there will be one so you will do just:


   VertexStates.getDataForFirstSelectedRow(event.widget.vertexState, [molField])


Cheers,
- m.