Jump to content


Photo

Questions about UniDBGrid

unidbgrid roweditor

  • Please log in to reply
25 replies to this topic

#1 jrp

jrp

    Member

  • Members
  • PipPip
  • 21 posts

Posted 24 April 2017 - 02:18 PM

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 Demo

I 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


  • 0

#2 jrp

jrp

    Member

  • Members
  • PipPip
  • 21 posts

Posted 26 April 2017 - 01:06 AM

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?


  • 0

#3 Delphi Developer

Delphi Developer

    Advanced Member

  • Moderators
  • 4754 posts

Posted 26 April 2017 - 11:37 AM

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...tor/#entry27782

 

Best regards,


  • 0

#4 jrp

jrp

    Member

  • Members
  • PipPip
  • 21 posts

Posted 26 April 2017 - 12:33 PM

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
  • 0

#5 jrp

jrp

    Member

  • Members
  • PipPip
  • 21 posts

Posted 26 April 2017 - 12:53 PM

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.


  • 0

#6 mxdeson

mxdeson

    Member

  • Members
  • PipPip
  • 23 posts

Posted 19 June 2017 - 01:39 PM

MainForm.Scripts:
Ext.apply(Ext.grid.RowEditor.prototype, {  
   saveBtnText: 'Ok',  
   cancelBtnText: 'Cancel',  
   errorsText: 'Error',  
   dirtyText: '...' 
});  
 

  • 0

#7 ydarsius

ydarsius

    Newbie

  • Members
  • Pip
  • 7 posts

Posted 28 September 2017 - 09:04 AM

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?


  • 0

#8 Delphi Developer

Delphi Developer

    Advanced Member

  • Moderators
  • 4754 posts

Posted 28 September 2017 - 11:21 AM

Hi,

Which edition and build are you using?

Best regards,
  • 0

#9 ydarsius

ydarsius

    Newbie

  • Members
  • Pip
  • 7 posts

Posted 29 September 2017 - 08:07 AM

delphi xe 6 and uni gui 1.0.0.1402..


  • 0

#10 Delphi Developer

Delphi Developer

    Advanced Member

  • Moderators
  • 4754 posts

Posted 29 September 2017 - 08:27 AM

Trial?
  • 0

#11 ydarsius

ydarsius

    Newbie

  • Members
  • Pip
  • 7 posts

Posted 29 September 2017 - 08:39 AM

no, complete license..


  • 0

#12 Delphi Developer

Delphi Developer

    Advanced Member

  • Moderators
  • 4754 posts

Posted 29 September 2017 - 08:50 AM

Ok, then please first visit here:
http://forums.unigui...t-announcement/

Thank you
  • 0

#13 jemmyhatta

jemmyhatta

    Member

  • uniGUI Subscriber
  • PipPip
  • 45 posts

Posted 29 September 2017 - 09:08 AM

sorry i just ordering my co worker to ask to u :D

 

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";


  • 0

#14 Delphi Developer

Delphi Developer

    Advanced Member

  • Moderators
  • 4754 posts

Posted 29 September 2017 - 09:15 AM

Ok, I will check and let you know
  • 0

#15 kkelchev

kkelchev

    Active Member

  • uniGUI Subscriber
  • PipPipPip
  • 66 posts

Posted 29 September 2017 - 05:46 PM

Is It possible , how to change grid line color  ?


  • 0

#16 Delphi Developer

Delphi Developer

    Advanced Member

  • Moderators
  • 4754 posts

Posted 29 September 2017 - 06:04 PM

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,


  • 0

#17 Delphi Developer

Delphi Developer

    Advanced Member

  • Moderators
  • 4754 posts

Posted 30 September 2017 - 10:52 AM

Hi,

 

when use [enter] for next line in memo

 

Which approach are you using for this ?


  • 0

#18 jrp

jrp

    Member

  • Members
  • PipPip
  • 21 posts

Posted 30 September 2017 - 12:38 PM

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


  • 0

#19 ydarsius

ydarsius

    Newbie

  • Members
  • Pip
  • 7 posts

Posted 09 October 2017 - 10:27 AM

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

 

2ajw2up.png


  • 0

#20 arilotta

arilotta

    Active Member

  • uniGUI Subscriber
  • PipPipPip
  • 95 posts
  • LocationTrieste, Italy

Posted 22 November 2017 - 04:48 PM

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


  • 0





Also tagged with one or more of these keywords: unidbgrid, roweditor

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users