Jump to content

How to TUniDBNavigator onclick discard default event?


Freeman35

Recommended Posts

This code not working. I mean "Abort;" not stop inserting.

procedure TFRM_.NAV_1BeforeAction(Sender: TObject; Button: TNavigateBtn);
begin
   if button=nbInsert then Abort;
end;

Why I need:

When endUser Clieck to insert I haveto handle it, then I wanna open my form. At this point, My dataset not will be insert mode. 'cos, this create transaction on server, and client need access to server, just if need post value to dataset.

dbnavigator, directly set insert mode sdEdit as well. Maybe can say, dbNavigator work like a nondb :) Its get db status so set buttons enable disable, but not sent command to dataset.

I hope traslate :)

Link to comment
Share on other sites

Hi,

 

This code not working. I mean "Abort;" not stop inserting.

procedure TFRM_.NAV_1BeforeAction(Sender: TObject; Button: TNavigateBtn);
begin
   if button=nbInsert then Abort;
end;

 

Sorry, I couldn't reproduce this issue, works for me

uses ... DBCtrls;

procedure TMainForm.UniDBNavigator1BeforeAction(Sender: TObject;
  Button: TNavigateBtn);
begin
  if button=nbInsert then Abort;
end;
Link to comment
Share on other sites

you mean,

procedure TMainForm.UniDBNavigator1BeforeAction(Sender: TObject;
  Button: TNavigateBtn);
begin
  if Button = nbfirst then
  Abort;
  ShowMessage('not aborted !!!!');
end;

not work "ShowMessage" and unidbgrid not add new empty line aren't you?  becouse I saw thats on my project, so I cancel use dbnavigator, add buttons to form and made manual navigator.

If its posible test this messagebox added code and write result.

Thank you for your help.

Link to comment
Share on other sites

Sorry, seems it is not clear to me what you want,

 

Also, maybe you need this approach ?!:

 

1. UniDBGrid -> ClientEvents -> ExtEvents -> function afterrender:

function afterrender(sender, eOpts)
{
    var me = sender;
    if (me.pagingBar) {
        me.pagingBar.getComponent("first").handler = function() {
            ajaxRequest(me, '_nbfirst', [])
        }
    }
}

2. UniDBGrid -> OnAjaxEvent:

procedure TMainForm.UniDBGrid1AjaxEvent(Sender: TComponent; EventName: string;
  Params: TUniStrings);
begin
  if EventName = '_nbfirst' then
  begin
    // your custom logic
    ShowMessage('first');
  end;
end;
Link to comment
Share on other sites

Thank you for your help. I clean everythink, and reinstall, now work normally.

Thank you,

regards

procedure TMainForm.UniDBNavigator1BeforeAction(Sender: TObject;
  Button: TNavigateBtn);
begin
  if not My_var__Is_Admin and Button in [nbInsert, nbEdit, nbDelete] then begin
    ShowMessage('You can not modify !!!!');
    Abort;
    ShowMessage('If you see this message, huston we have a BIG problem...not aborted !!!!');
  end;
end;
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...