Topic: Save Button for Editable tGrid?

I have an editable tGrid on a form with save button.


Is it possible to have a separate "Save" button for editable tGrid only so that users can see they need to save entered tGrid data before clicking on the form save button?
Currently, if user clicks on form save button while grid edit line in edit mode data is not saved.


I understand that editable tGrid saves entered data automatically by clicking on other parts of the tGrid or pressing enter/return key on keyboard (if there is no save button with closeon the form.)

Adam
God... please help me become the person my dog thinks I am.

Re: Save Button for Editable tGrid?

Hi Adam,
If I understand this correctly, you could perhaps approach it as per the attached.  Probably lots of other ways too but this seems pretty straightforward.
Regards,
Derek.

Post's attachments

Attachment icon adam tgrid.zip 336.72 kb, 377 downloads since 2017-10-20 

Re: Save Button for Editable tGrid?

It's not support.

Dmitry.

Re: Save Button for Editable tGrid?

Hi Derek,


Thank you very much for the workaround...................
Truly appreciated...........................


I hit another wall that I couldn't go through, dig under or jump over.


My intention was to use editable grid as a part of the record details. For example we have contacts (people), when adding / editing contact I was planning to add their phone numbers using editable grid rather than many fields. However, I couldn't connect editable grid data to selected contact so that editable grid on frmPeople shows only edited person's phone numbers not all (When editing)
On Form1, non editable grid shows the phone numbers of only selected person from TableGrid1 in this case.


Please see the attached sample project below:

Post's attachments

Attachment icon adam tgrid 2.zip 7.36 kb, 360 downloads since 2017-10-20 

Adam
God... please help me become the person my dog thinks I am.

Re: Save Button for Editable tGrid?

Check it out

Post's attachments

Attachment icon adam tgrid 2_fixed.zip 7.53 kb, 403 downloads since 2017-10-20 

Dmitry.

Re: Save Button for Editable tGrid?

Hi Dmitry,


Thank you very much..............
Truly appreciated....................


Could you possibly let me have the code to replicate pressing keyboard ENTER key please.
In this case, I like to use it for save grid button.


Derek's workaround is nice but if user clicks on SAVE GRID button after entering a row of data, it doesn't commit the entered row data, unless user press on ENTER key on keyboard or clicks on somewhere on editable grid (except first row)

Adam
God... please help me become the person my dog thinks I am.

Re: Save Button for Editable tGrid?

AD1408 wrote:

Hi Dmitry,

Could you possibly let me have the code to replicate pressing keyboard ENTER key please.
In this case, I like to use it for save grid button.

Please explain the question on more detail.

Dmitry.

Re: Save Button for Editable tGrid?

DriveSoft wrote:
AD1408 wrote:

Hi Dmitry,

Could you possibly let me have the code to replicate pressing keyboard ENTER key please.
In this case, I like to use it for save grid button.

Please explain the question on more detail.


As far as I could understand editable grid commits (saves) new data entered on first row:
- When enter key on keyboard pressed
- When clicked on any saved row

This is fine with editable grid on a form without a "form save button". When editable grid placed on a form with "Form Save Button" I like to place a SAVE GRID button for the editable grid. Clicking on SAVE GRID saves the data entered on first row of the editable grid only by adding save/enter code to SAVE GRID button.

procedure frmPeople_btnSaveGrid_OnClick (Sender: string; var Cancel: boolean);
begin
  frmPeople.TableGrid1.??????;
end;

https://s1.postimg.org/19hb3nruof/zzzzz_Temp69.png

Adam
God... please help me become the person my dog thinks I am.

Re: Save Button for Editable tGrid?

Editable tablegrid is independent, there is no way to change it by script.

Dmitry.

10 (edited by AD1408 2017-10-27 14:29:40)

Re: Save Button for Editable tGrid?

DriveSoft wrote:

Editable tablegrid is independent, there is no way to change it by script.


My intention was not to change actual tablegrid. Rather duplicate keyboard and mouse actions associated with the tablegrid such as on the image below.

https://s1.postimg.org/1cdrqs6cdr/zzzzz_Temp70.png


Adding, editing, deleting and saving tablegrid actions are available via keyboard or mouse clicks.
Delete action works with button already.

I'm still not clear why we cannot add, edit and save via buttons too like with delete button.
Add and Edit buttons are not so important, in fact it's more convenient via keyboard an mouse. However, SAVE button is needed in certain circumstances (as explained on previous posts on this topic)

Adam
God... please help me become the person my dog thinks I am.