jrp Posted April 24, 2017 Share Posted April 24, 2017 Hello,I had just discovered UniGUI and currently evaluating it. UniGUI is very cool! I can use Delphi, but I don't know anything about developing web application. Now UniGUI make things looks familiar and easy. I hope that I never have to learn another programming language to develop web applications.I have questions about UniDBGrid. Please download the attachment to understand my questions better. It is a slightly modified UniGUI GridEditors - Row Editor DemoI use Delphi Berlin Starter & UniGUI 1.0.0.1385 Trial.Now the questions: 1. When I'm editing a record by double-clicking the grid, UniDBGrid1.DataSource.State is dsBrowse. Is this a bug? Because when I do editing by clicking the edit button in the UniDBNavigator1 or by code, UniDBGrid1.DataSource.State is dsEdit (correct behaviour).2. How to make it so that UniDBGrid1 can't be edited by double click but can be edited by code (eg. by clicking btAppend or btEdit) ? 3. How to make the Confirm and Cancel button dissapear when editing in RowEditor mode? I want to use another buttons outside the grid to do Post and Cancel by myself because I have several things to do before & after post (I can't use ClientDataset1.BeforePost & AfterPost events because the code will look bad).4. How to change the Caption and give icons to the Confirm and Cancel buttons? Thanks in advance Quote Link to comment Share on other sites More sharing options...
jrp Posted April 26, 2017 Author Share Posted April 26, 2017 I tried a solution for question 2 with the following concept: UniDBGrid created with ReadOnly:=true; In the OnClick events of the button for editing (eg. btAppend & btEdit), make UniDBGrid.ReadOnly:=false; before calling Dataset.Append/Dataset.Edit In the dataset's AfterPost & AfterCancel events, set UniDBGrid.ReadOnly:=true; In code: procedure TMainForm.UniFormCreate(Sender: TObject); begin {$ifdef COMPILER_14_UP} with FormatSettings do {$endif} begin DateSeparator:='/'; CurrencyFormat:=0; CurrencyString:='$'; end; UniDBGrid1.ReadOnly:=True; end; procedure TMainForm.btEditClick(Sender: TObject); begin if ClientDataSet1.IsEmpty then Exit; UniDBGrid1.ReadOnly:=False; ClientDataSet1.Edit; end; procedure TMainForm.btAppendClick(Sender: TObject); begin UniDBGrid1.ReadOnly:=False; ClientDataSet1.Append; end; procedure TMainForm.ClientDataSet1AfterCancel(DataSet: TDataSet); begin UniDBGrid1.ReadOnly:=True; end; procedure TMainForm.ClientDataSet1AfterPost(DataSet: TDataSet); begin UniDBGrid1.ReadOnly:=True; end; The solution seems to work fine at first, but on the second time you try to do editing by clicking btAppend or btEdit then Ajax error happened: O13.rdonly=false;O60.setDisabled(true);O64.setDisabled(false);O68.setDisabled(false);O78.setText("dsEdit");delete O13_Cols;delete O13.view.cachedColumns; OC7=new Ext.grid.column.Column({ogrid:O13,sortable:false,dataIndex:"0",renderer:_rndcll_,rdonly:false,locked:true,text:"Id No",align:"right",ct:"number",width:94,editor:{xtype:"textfield"}});OC7.nm="OC7";OC7.editor.focusDisabled=true; OC8=new Ext.grid.column.Column({ogrid:O13,sortable:false,dataIndex:"1",renderer:_rndcll_,rdonly:false,text:"Last Name",width:124,editor:O2E});OC8.nm="OC8";O2E.name="1";OC8.editor.focusDisabled=true; OC9=new Ext.grid.column.Column({ogrid:O13,sortable:false,dataIndex:"2",renderer:_rndcll_,rdonly:false,text:"First Name",width:94,editor:O3C});OC9.nm="OC9";O3C.name="2";OC9.editor.focusDisabled=true; OCA=new Ext.grid.column.Column({ogrid:O13,sortable:false,dataIndex:"3",renderer:_rndcll_,rdonly:false,text:"Phone Ext.",width:72,editor:O38});OCA.nm="OCA";O38.name="3";OCA.editor.focusDisabled=true; OCB=new Ext.grid.column.Column({ogrid:O13,sortable:false,dataIndex:"4",renderer:_rndcll_,rdonly:false,text:"Hire Date",cf:"d/m/Y",ct:"datetime",width:112,editor:O88});OCB.nm="OCB";var e=O88;if(e.picker){e.picker.destroy();delete e.picker;};O88.name="4";OCB.editor.focusDisabled=true; OCC=new Ext.grid.column.Column({ogrid:O13,sortable:false,dataIndex:"5",renderer:_rndcll_,rdonly:false,text:"Salary",align:"right",cf:"$$0,0.00",ct:"float",width:86,editor:{xtype:"textfield"}});OCC.nm="OCC";OCC.editor.focusDisabled=true; OCD=new Ext.grid.column.Column({ogrid:O13,sortable:false,dataIndex:"6",renderer:_rndcll_,rdonly:false,text:"Work Start",cf:"H:i",ct:"time",width:71,editor:O8C});OCD.nm="OCD";O8C.name="6";OCD.editor.focusDisabled=true; OCE=new Ext.grid.column.Column({ogrid:O13,sortable:false,dataIndex:"7",renderer:_rndcll_,rdonly:false,locked:true,text:"City",width:88,editor:O32});OCE.nm="OCE";O32.name="7";OCE.editor.focusDisabled=true;var O13_Cols=[OC7,OC8,OC9,OCA,OCB,OCC,OCD,OCE];O13.reconfigure(null,O13_Cols);O13.uniConfigColumns();OC7.setElProp({"text-align":"left"},null,0,null,null,"titleEl");OC8.setElProp({"text-align":"center"},null,0,null,null,"titleEl");OCC.setElProp({"text-align":"left"},null,0,null,null,"titleEl");_sge_(O13,0,0,true); What could be wrong? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted April 26, 2017 Share Posted April 26, 2017 Hi, 1. When I'm editing a record by double-clicking the grid, UniDBGrid1.DataSource.State is dsBrowse. Is this a bug? Because when I do editing by clicking the edit button in the UniDBNavigator1 or by code, UniDBGrid1.DataSource.State is dsEdit (correct behaviour). We will analyze it. 2, 3 And what if you will use 'another form' to edit and insert record?! 4. How to change the Caption and give icons to the Confirm and Cancel buttons? Can you try this approach for now?!: http://forums.unigui.com/index.php?/topic/5436-change-update-cancel-captions-in-roweditor/&do=findComment&comment=27782 Best regards, Quote Link to comment Share on other sites More sharing options...
jrp Posted April 26, 2017 Author Share Posted April 26, 2017 Hello Delphi Developer, For complex data entry, I would use a separate form like you said. But for simple data entry it is simpler to use grids. And UniDBGrid is very very good grid with built-in row editor functionality. I think question no 2 & 3 is important for good code, because we can have most control over the whole process of receiving input from user, validate it, posting it to the database and also do some processing before and after the post. This will be valuable. For question no 4, I will try it. Thanks Quote Link to comment Share on other sites More sharing options...
jrp Posted April 26, 2017 Author Share Posted April 26, 2017 Hello Delphi Developer,I have put Ext.grid.RowEditor.prototype.cancelBtnText = "This is cancel"; Ext.grid.RowEditor.prototype.saveBtnText = "This is update"; in MainForm.Scripts, but it doesn't work. The caption is still Confirm and Cancel. Quote Link to comment Share on other sites More sharing options...
mxdeson Posted June 19, 2017 Share Posted June 19, 2017 MainForm.Scripts: Ext.apply(Ext.grid.RowEditor.prototype, { saveBtnText: 'Ok', cancelBtnText: 'Cancel', errorsText: 'Error', dirtyText: '...' }); Quote Link to comment Share on other sites More sharing options...
ydarsius Posted September 28, 2017 Share Posted September 28, 2017 Hi Delphi Developer, when i use unimemo in dbgrid roweditor, i'm getting problem when use [enter] for next line in memo, its just keep updating/ applying.. and can i use enter as tab in dbgrid roweditor? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted September 28, 2017 Share Posted September 28, 2017 Hi, Which edition and build are you using? Best regards, Quote Link to comment Share on other sites More sharing options...
ydarsius Posted September 29, 2017 Share Posted September 29, 2017 delphi xe 6 and uni gui 1.0.0.1402.. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted September 29, 2017 Share Posted September 29, 2017 Trial? Quote Link to comment Share on other sites More sharing options...
ydarsius Posted September 29, 2017 Share Posted September 29, 2017 no, complete license.. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted September 29, 2017 Share Posted September 29, 2017 Ok, then please first visit here: http://forums.unigui.com/index.php?/topic/6291-important-announcement/ Thank you Quote Link to comment Share on other sites More sharing options...
jemmyhatta Posted September 29, 2017 Share Posted September 29, 2017 sorry i just ordering my co worker to ask to u so the problem still the same.. also i try the change caption commit and cancel button still not work.. MainForm.Scripts ... add: Ext.grid.RowEditor.prototype.cancelBtnText = "This is cancel";Ext.grid.RowEditor.prototype.saveBtnText = "This is update"; Quote Link to comment Share on other sites More sharing options...
Sherzod Posted September 29, 2017 Share Posted September 29, 2017 Ok, I will check and let you know Quote Link to comment Share on other sites More sharing options...
kkelchev Posted September 29, 2017 Share Posted September 29, 2017 Is It possible , how to change grid line color ? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted September 29, 2017 Share Posted September 29, 2017 Hi, also i try the change caption commit and cancel button still not work.. MainForm.Scripts ... add: Ext.grid.RowEditor.prototype.cancelBtnText = "This is cancel";Ext.grid.RowEditor.prototype.saveBtnText = "This is update"; Can you try this approach ?!: UniDBGrid1 -> ClientEvents -> ... function afterrender(sender, eOpts) { var edPl=sender.editingPlugin; if (edPl && edPl.isRowEditor) { edPl.saveBtnText='Confirm!'; edPl.cancelBtnText='Cancel!'; }; } Best regards, Quote Link to comment Share on other sites More sharing options...
Sherzod Posted September 30, 2017 Share Posted September 30, 2017 Hi, when use [enter] for next line in memo Which approach are you using for this ? Quote Link to comment Share on other sites More sharing options...
jrp Posted September 30, 2017 Author Share Posted September 30, 2017 Hello, I have not tried UniGUI again in a few months. Do someone have answers for question no 1 - 3? 1. When I'm editing a record by double-clicking the grid, UniDBGrid1.DataSource.State is dsBrowse. Is this a bug? Because when I do editing by clicking the edit button in the UniDBNavigator1 or by code, UniDBGrid1.DataSource.State is dsEdit (correct behaviour).2. How to make it so that UniDBGrid1 can't be edited by double click but can be edited by code (eg. by clicking btAppend or btEdit) ? 3. How to make the Confirm and Cancel button dissapear when editing in RowEditor mode? I want to use another buttons outside the grid to do Post and Cancel by myself because I have several things to do before & after post (I can't use ClientDataset1.BeforePost & AfterPost events because the code will look bad). Thanks Quote Link to comment Share on other sites More sharing options...
ydarsius Posted October 9, 2017 Share Posted October 9, 2017 Hi, Which approach are you using for this ? hi sorry for late reply.. when i use unimemo i cant use [enter] for next line in memo Quote Link to comment Share on other sites More sharing options...
arilotta Posted November 22, 2017 Share Posted November 22, 2017 Hi Delphi Developer, I am experiencing the same problem signaled by jrp at point 1: When I'm editing a record by double-clicking the grid, UniDBGrid1.DataSource.State is dsBrowse. Is this a bug? Because when I do editing by clicking the edit button in the UniDBNavigator1 or by code, UniDBGrid1.DataSource.State is dsEdit (correct behaviour). Has this been fixed in recent versions ? I'm running on build 1401... Thank you Quote Link to comment Share on other sites More sharing options...
Sherzod Posted November 22, 2017 Share Posted November 22, 2017 Hi, Ok, we will check it Quote Link to comment Share on other sites More sharing options...
arilotta Posted November 23, 2017 Share Posted November 23, 2017 Thank you Delphi Dev. jrp, if you want to achieve the behaviour at point 2, add the following proc to the OnStateChange handler for the datasource bound to your dataset: procedure TMainForm.SRCconfig_LKStateChange(Sender: TObject); begin if (Sender as TOraDataSource).State in [dsEdit, dsInsert] then begin GRDconfig_LK.Options:=GRDconfig_LK.Options+[dgEditing]; GRDconfig_LK.SetFocus; end else GRDconfig_LK.Options:=GRDconfig_LK.Options-[dgEditing]; end; Quote Link to comment Share on other sites More sharing options...
jrp Posted November 23, 2017 Author Share Posted November 23, 2017 Hi arilotta, Thank you for the workaround. I have not tried it yet, but looking at your code, I think it will work. I hope someday it will be fixed in UniGUI so programmers can expect same behaviour in UniGUI like in VCL. Quote Link to comment Share on other sites More sharing options...
zhyhero Posted February 10, 2018 Share Posted February 10, 2018 Find another way to modify the text of roweditor's 'confirm' and 'cancel' button. in unibasicgrid unit,change the red color code to your string. (the old version) Or in Vcl.consts unit,change the value of SMsgDlgCancel and SMsgDlgConfirm. procedure TUniBasicGrid.ConfigLoadCompleted;begin if FHeaderTitle<>'' then begin JSConfig('title', [FHeaderTitle]); JSConfig('titleAlign', [GetAlignWebText(FHeaderTitleAlign)]); end; if FCellCursor<>crDefault then JSAssign('xcursor', [Cursor2Web(FCellCursor)]); if not FStripeRows then JSConfigObject('viewConfig', 'stripeRows', [FStripeRows]); if not FTrackOver then JSConfigObject('viewConfig', 'trackOver', [False]); if gcfgSupportsEditor in FInternalConfig then begin if FRowEditor then begin JSConfigPlugin('Ext.grid.plugin.RowEditing', [ 'pluginId','uniGridEditor', 'isRowEditor', True, 'cancelBtnText', uniRemoveAmp(SMsgDlgCancel), 'saveBtnText', uniRemoveAmp(SMsgDlgConfirm), 'clicksToEdit', FClicksToEdit, 'editorCfg', JSObject([ 'listeners', JSObject([ 'beforehide', JSObject([ 'fn', JSFunction('me', 'return(me.canhide === true)'), 'scope', JSStatement('this') ]) ]) ]), 'listeners', JSObject([ 'beforeedit', JSObject([ 'fn', JSFunction('me, context', 'return (!context.grid.rdonly)') ]) ]) ] ); end else begin JSConfigPlugin('Ext.grid.plugin.CellEditing', [// 'triggerEvent', 'cellfocus', 'pluginId','uniGridEditor', 'clicksToEdit', FClicksToEdit ] ); end; end; Quote Link to comment Share on other sites More sharing options...
Sherzod Posted February 10, 2018 Share Posted February 10, 2018 Hi, Find another way to modify the text of roweditor's 'confirm' and 'cancel' button. in unibasicgrid unit,change the red color code to your string. (the old version) Or in Vcl.consts unit,change the value of SMsgDlgCancel and SMsgDlgConfirm. ... Which edition and build are you using ? 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.