Jump to content

How to change dbgrid editor on runtime


Recommended Posts


i would like change the editor control of columns in runtime.

i do a simple test case :

i add a unicheckcombobox in the hidden panel

i add a radiogroup for switching the editor property for the column "city" between combobox and checkcombobox.

-> if you select combox -> the editor for column city must be a combobox

-> if you select Checkcombox -> the editor for column city must be a Checkcombobox but it is not work


is there anyone that could said me why it is not working and how can ido for do this change of control on runtime ?



Link to comment
Share on other sites

i want that the user could choice the type of control for each column.

the user could choice between combobox checkcombobox, checkbox, radiogroup, memo .......

i have 48 column for this grid, if i create them only on demand when it is necessary if think it is better than to have 48 combobox + 48 checkcombobox+48 checkbox+..... that are not realy used


and after i must do the same thing for the filter contol!!!!

Link to comment
Share on other sites

so, in my project i create all editor unicheckcombobox in designtime.

if in designtime ,i set the editor to the control unicheckcombobox there is not error message.


if i set the editor to a combobox in designtime and after i change the control to the unicheckcomboboxcontrol i have problem :

the value are not checked when the control display the dropdown list and when the value is set by the control i have this error message :


Uncaught TypeError: can't access property "attributes", m is null


for change the control at runtime i use your method

  cureditor := TUniFormControl(GetControlByName(UpperCase(aGrid.Columns[i].FieldName),aTypeControl));
  aGrid.Columns[i].Editor := cureditor ;
  aGrid.JSInterface.JSCall('setEditor', [TUniFormControl(cureditor).JSControl], aGrid.Columns[i].JSColumn);
  TUniFormControl(cureditor).JSInterface.JSAssign('valueField', ['val']);

have you got an idea to fix this ?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...