jeffswanberg Posted July 11, 2016 Share Posted July 11, 2016 Assuming I have a unidbgrid with five columns attached to a data set. How do I disable the editing on columns 1, 2 and 3 when the value of the fifth column is 1 but they are editable if the value in the fifth column is anything else?And, in which event would this be best suited? Jeff Link to comment Share on other sites More sharing options...
Sherzod Posted July 11, 2016 Share Posted July 11, 2016 Hi, You can use, DataSource->onDataChange event, for example: procedure TMainForm.DataSource1DataChange(Sender: TObject; Field: TField); begin if (Sender as TDataSource).DataSet.Fields[3].AsInteger = 1 then begin (Sender as TDataSource).DataSet.Fields[3].ReadOnly := True end else begin (Sender as TDataSource).DataSet.Fields[3].ReadOnly := False end; end; Best regards. Link to comment Share on other sites More sharing options...
clement Posted August 4, 2017 Share Posted August 4, 2017 Is it possible to set one cell to ReadOnly = True/False? for example, Row 1 -> if the 1st column's value is Y, then the 2nd column is "ReadOnly = True" (cannot edit) Row 2 -> the 1st column's value is N, then the 2nd column is "ReadOnly = False" (can edit) Link to comment Share on other sites More sharing options...
Sherzod Posted August 4, 2017 Share Posted August 4, 2017 Hi, Which build and edition are you using? Best regards, Link to comment Share on other sites More sharing options...
clement Posted August 4, 2017 Share Posted August 4, 2017 uniGUI Complete Trial Edition 1.0.0 Build 1402 thanks. Link to comment Share on other sites More sharing options...
Sherzod Posted August 4, 2017 Share Posted August 4, 2017 Can you try to analyze this post?: http://forums.unigui.com/index.php?/topic/8255-how-to-disable-key-press-on-unidbgrid/?hl=beforeedit&do=findComment&comment=42185 Link to comment Share on other sites More sharing options...
clement Posted August 4, 2017 Share Posted August 4, 2017 Thanks for your reply. ColA is CheckBox ColA | ColBRow1 True Success (Row1 - ColA ReadOnly Is False)Row2 False Fail (Row2 - ColA ReadOnly Is True)Row3 False Fail (Row3 - ColA ReadOnly Is True)Row4 False Success (Row4 - ColA ReadOnly Is False)It means user can only edit the ColA of Row1 & Row4. function beforeedit(editor, context, eOpts){ var me=context; if ((me.column.dataIndex == "0") && (me.record.data[1] != "Success")) { return false; }} I use the above code, but Row 2 & Row 3 (ColA) still can be edited. Anything is wrong? Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now