jeffswanberg Posted July 11, 2016 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 Quote
Sherzod Posted July 11, 2016 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. Quote
clement Posted August 4, 2017 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) Quote
Sherzod Posted August 4, 2017 Posted August 4, 2017 Hi, Which build and edition are you using? Best regards, Quote
clement Posted August 4, 2017 Posted August 4, 2017 uniGUI Complete Trial Edition 1.0.0 Build 1402 thanks. Quote
Sherzod Posted August 4, 2017 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 Quote
clement Posted August 4, 2017 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? Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.