Re: [SOLVED] TagbleGrid, Pagination, Footer and Offset

Thank you Derek for your kindness,
It is perfect for what I want to achieve.

@thezimguy

27 (edited by thezimguy 2018-09-03 16:09:35)

Re: [SOLVED] TagbleGrid, Pagination, Footer and Offset

Hello Dmitry, Derek and MVD users,
Please I have another question
Is there a way to catch the actions of a button

Example
.............
I have a button with action [SAVE RECORD]
if I click on the button, I want to know whether it is for saving or updating
Example

procedure btnSaveOnClick(Sender:TObject; var Cancel:Boolean; Action:String);
Begin
Showmessage(Action);
End;

I want to catch the action before deciding whether to save or not
Thanks

@thezimguy

Re: [SOLVED] TagbleGrid, Pagination, Footer and Offset

procedure Form2_btnSave_OnClick (Sender: TObject; var Cancel: boolean);
begin
    If Form2.dbAction = 'NewRecord' then ShowMessage('Adding a New Record.');
    If Form2.dbAction = 'ShowRecord' then ShowMessage('Updating a Record.');
end;

Re: [SOLVED] TagbleGrid, Pagination, Footer and Offset

ehwagner wrote:
procedure Form2_btnSave_OnClick (Sender: TObject; var Cancel: boolean);
begin
    If Form2.dbAction = 'NewRecord' then ShowMessage('Adding a New Record.');
    If Form2.dbAction = 'ShowRecord' then ShowMessage('Updating a Record.');
end;

Thank you so much. I really appreciate your help.
It works perfectly

@thezimguy

Re: [SOLVED] TagbleGrid, Pagination, Footer and Offset

Also, if you want to prevent the record from saving you can put in

Cancel := True;

I usually will follow it with an Exit; to leave the procedure immediately;

Re: [SOLVED] TagbleGrid, Pagination, Footer and Offset

Hello,
Please what am I doing wrong?
I'm trying to filter a Table Grid with text from an EidtBox,

https://s6.postimg.cc/vt7jtrt81/t_Grid_Filter_With_Edit_Box.png
Can I include EditBox Text in the Filter of the TableGrid?
Any Help?
Regards

@thezimguy

Re: [SOLVED] TagbleGrid, Pagination, Footer and Offset

You only need the part after the WHERE clause to filter. It looks like in your case that it should be privPage.id_user = {edUserId}

Re: [SOLVED] TagbleGrid, Pagination, Footer and Offset

Thank you bro, but it's till not working for me.
I'm getting this error

Error message: unrecognized token: "{"

I'm grateful
Regards

@thezimguy

Re: [SOLVED] TagbleGrid, Pagination, Footer and Offset

My apology. I typically do not use the filter in the tablgrid settings. I usually use SQL Query where you can use form fields in the sql. The form field needs to be placed within the braces inside single quotes ( '{edUserId}' ). I don't believe you can place edit fields in the filter box of the tablegrid settings.

Re: [SOLVED] TagbleGrid, Pagination, Footer and Offset

Thank you for the information

@thezimguy

Re: [SOLVED] TagbleGrid, Pagination, Footer and Offset

thezimguy
You can't use values of component in this field "3. Filter"


But you can change this filter by script, example:

procedure Form1_Edit1_OnChange (Sender: TObject);
begin
    Form1.TableGrid1.dbFilter := 'privPage.id_user = (SELECT user.id FROM user WHERE user.users="'+Form1.Edit1.sqlValue+'")'
end;
Dmitry.

Re: [SOLVED] TagbleGrid, Pagination, Footer and Offset

Thank you Dmitry,
I really appreciate the information given
Regards

@thezimguy

Re: [SOLVED] TagbleGrid, Pagination, Footer and Offset

Hi Dmitry,
I wish a navigation component can be added to the tableGrid for (next, previous, etc)
Thank you.

@thezimguy

Re: [SOLVED] TagbleGrid, Pagination, Footer and Offset

Hi,
I don't know if table navigation is to be included as a standard component in the next version but you can navigate through a tablegrid by using a script;  please have a look at the attached example.
Regards,
Derek.

Post's attachments

Attachment icon tablegridnavigate.zip 349.8 kb, 423 downloads since 2018-12-01 

Re: [SOLVED] TagbleGrid, Pagination, Footer and Offset

derek wrote:

Hi,
I don't know if table navigation is to be included as a standard component in the next version but you can navigate through a tablegrid by using a script;  please have a look at the attached example.
Regards,
Derek.

Thank you Derek.
I already have the script version of it and wish that it would be added to the current veraon as a standard component.

@thezimguy

Re: [SOLVED] TagbleGrid, Pagination, Footer and Offset

The component I'm talking about is in respect with this post
http://myvisualdatabase.com/forum/viewtopic.php?id=4447

@thezimguy

Re: [SOLVED] TagbleGrid, Pagination, Footer and Offset

Hello Dmitey,
Please can you add the dbLimit to the property window of the tableGrid?
So that we can set the default limit without coding.
And I wish a navigation control will be added to the tableGrid soon. Thank you.
Regards

@thezimguy

43 (edited by thezimguy 2018-12-25 07:06:45)

Re: [SOLVED] TagbleGrid, Pagination, Footer and Offset

Also, does the tableGrid got a property for total records in the database table?. I know we can query the database for that but I was wondering if it has already that property.
Thanks

@thezimguy

Re: [SOLVED] TagbleGrid, Pagination, Footer and Offset

The attached shows a tableGrid with pagination (first,previous, next and last)
I have added the code for the first three.

What will be the best code for the last button.
Regards.

Post's attachments

Attachment icon pagination.zip 348.04 kb, 374 downloads since 2018-12-25 

@thezimguy

Re: [SOLVED] TagbleGrid, Pagination, Footer and Offset

thezimguy wrote:

Hello Dmitey,
Please can you add the dbLimit to the property window of the tableGrid?
So that we can set the default limit without coding.

Done.
Please download latest beta version
https://www.dropbox.com/s/anufoqnsh809x … a.zip?dl=0

Dmitry.

Re: [SOLVED] TagbleGrid, Pagination, Footer and Offset

thezimguy wrote:

Also, does the tableGrid got a property for total records in the database table?. I know we can query the database for that but I was wondering if it has already that property.
Thanks

You can get count of rows in the TableGrid

Form1.TableGrid1.RowCount
Dmitry.

Re: [SOLVED] TagbleGrid, Pagination, Footer and Offset

thezimguy wrote:

The attached shows a tableGrid with pagination (first,previous, next and last)
I have added the code for the first three.

What will be the best code for the last button.
Regards.

procedure Form1_btnLast_OnClick (Sender: TObject; var Cancel: boolean);
var
    qRecords: integer;
begin
    qRecords := SQLExecute('SELECT COUNT(ID) FROM employees');
    Form1.GridEmployees.dbLimit := StrToInt(Form1.cbPages.Text);
    Form1.GridEmployees.dbOffSet := qRecords - Form1.GridEmployees.dbLimit;
    Form1.GridEmployees.dbUpdate;
end;
Dmitry.

Re: [SOLVED] TagbleGrid, Pagination, Footer and Offset

Thank you Father Christmas
Really appreciated

@thezimguy

49 (edited by thezimguy 2018-12-27 09:57:48)

Re: [SOLVED] TagbleGrid, Pagination, Footer and Offset

Again Dmitry,
I wish this feature will added to the tableGrid for easy alignment of column cells.
Find attached image below
https://i.postimg.cc/qRNx6zpb/alignment.png

It will be very nice to align the columns without having to write code.
Thank you.

@thezimguy

Re: [SOLVED] TagbleGrid, Pagination, Footer and Offset

thezimguy wrote:

Again Dmitry,
I wish this feature will added to the tableGrid for easy alignment of column cells.
Find attached image below
https://i.postimg.cc/qRNx6zpb/alignment.png

It will be very nice to align the columns without having to write code.
Thank you.

This will be great addition to the tableGrid.
I wish Dmitry will consider this and add it early for us.
Nice idea