sicoobcooplivre Posted June 7, 2022 Author Share Posted June 7, 2022 Sorry for my difficulty in explaining. I will study to improve! Thanks for listening! Quote Link to comment Share on other sites More sharing options...
Sherzod Posted June 7, 2022 Share Posted June 7, 2022 2 minutes ago, sicoobcooplivre said: So: by default, my forms load like this: UniDBGrid1.Options := [ dgTitles,dgIndicator,dgColumnResize,dgColLines,dgRowLines,dgConfirmDelete,dgTabs,dgCancelOnExit]; When I click the edit button, I need to change the options like this: UniDBGrid1.Options := [dgEditing,dgTitles,dgIndicator,dgColumnResize,dgColLines,dgRowLines,dgConfirmDelete,dgTabs,dgCancelOnExit]; and I need the roweditor combobox to work, as shown in the image. I'll try to provide a workaround tomorrow. Quote Link to comment Share on other sites More sharing options...
sicoobcooplivre Posted June 7, 2022 Author Share Posted June 7, 2022 My whole project was designed like this. For the next ones, I'll rethink! Thank you very much for your attention and help! Quote Link to comment Share on other sites More sharing options...
Sherzod Posted June 8, 2022 Share Posted June 8, 2022 Hello, For now, you can use the method used in this post: Quote Link to comment Share on other sites More sharing options...
sicoobcooplivre Posted June 9, 2022 Author Share Posted June 9, 2022 @SherzodGood Morning! Sorry, but since I don't have little knowledge, I couldn't apply the method in my example. Please, can't you apply it to the example I attached here on the forum to help me? Thanks! Quote Link to comment Share on other sites More sharing options...
Sherzod Posted June 9, 2022 Share Posted June 9, 2022 Hello, Ok. I will try. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted June 9, 2022 Share Posted June 9, 2022 1 hour ago, sicoobcooplivre said: but since I don't have little knowledge, I couldn't apply the method in my example. Please, can't you apply it to the example I attached here on the forum to help me? Can you try? In your testcase: 1. MainFrom.OnCreate event: procedure TMainForm.UniFormCreate(Sender: TObject); begin UniDBGrid1.CustomAttribs.Values['rdonly'] := 'true'; //<---------- with PFmtSettings^ do begin DateSeparator := '/'; CurrencyFormat := 0; CurrencyString := '$'; end; end; 2. procedure TMainForm.UniButton1Click(Sender: TObject); begin UniButton1.Enabled := False; UniButton2.Enabled := True; UniButton3.Enabled := True; //UniDBGrid1.Options := [dgEditing,dgTitles,dgIndicator,dgColumnResize,dgColLines,dgRowLines,dgConfirmDelete,dgTabs,dgCancelOnExit]; UniDBGrid1.CustomAttribs.Values['rdonly'] := 'false'; end; procedure TMainForm.UniButton2Click(Sender: TObject); begin UniButton1.Enabled := True; UniButton2.Enabled := False; UniButton3.Enabled := False; //UniDBGrid1.Options := [dgTitles,dgIndicator,dgColumnResize,dgColLines,dgRowLines,dgConfirmDelete,dgTabs,dgCancelOnExit]; UniDBGrid1.CustomAttribs.Values['rdonly'] := 'true'; end; procedure TMainForm.UniButton3Click(Sender: TObject); begin UniButton1.Enabled := True; UniButton2.Enabled := False; UniButton3.Enabled := False; //UniDBGrid1.Options := [dgTitles,dgIndicator,dgColumnResize,dgColLines,dgRowLines,dgConfirmDelete,dgTabs,dgCancelOnExit]; UniDBGrid1.CustomAttribs.Values['rdonly'] := 'true'; end; 3. In designTime: UniDBGrid1.Options = [dgEditing, ...] 4. UniDBGrid1.ClientEvents.ExtEvents -> function beforeedit(editor, context, eOpts) { return ajaxRequest(this, 'getCheck', [], false).responseText !== 'true'; } 5. UniDBGrid1.OnAjaxEvent: procedure TMainForm.UniDBGrid1AjaxEvent(Sender: TComponent; EventName: string; Params: TUniStrings); begin if EventName = 'getCheck' then begin UniSession.SendResponse((Sender as TUniDBGrid).CustomAttribs.Values['rdonly']); end; end; Quote Link to comment Share on other sites More sharing options...
sicoobcooplivre Posted June 13, 2022 Author Share Posted June 13, 2022 @SherzodGood Morning! TOP, Congratulations! Thank you very much for watching me! Problem solved! Great week! 1 Quote Link to comment Share on other sites More sharing options...
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.