Addrow with preset value for mysql database

In my application I have a grid showing all rows for a certain project, the ProjectNr is selected by a ‘where’ clause in the SQL command, but not shown in the grid.
When I add a row (with an autoincrement id) the new record should get the ProjectNr field set to the selected projectnr.

I don’t understand how to set a value for a column that is not shown with the addrow command. Are there any alternative methods?

Are you using connector or some custom server side solution ?
In case of connector, such value can be hardcoded in the update query.

In case of custom solution you can use userdata ( grid.setUserData ), which allows to attach named properties to the rows of grid. ( dataprocessor will send them with data of updated row to the server, so they will be available for your custom code )

I’m using the GridConnector. But I’m sorry, I don’t understand what you mean with “hardcoded”.

I found a simple solution:

  • add column with field ProjNr
  • hide this column with setColumnHidden
  • define the ProjNr as a rowvalue in the call to addRow