Jump to content
uniGUI Discussion Forums
Sign in to follow this  
jahlxx

client events run time

Recommended Posts

H,

 

I do this for dbgrids in run time:

 

   tunidbgrid(xdbg).ClientEvents.unievents.Values['beforeinit']:='function beforeinit(sender, config)' +
             '{config.viewConfig.enableTextSelection = true;}';
 

This don't work.

 

How can I do it in run time?

 

Thanks.

 

Share this post


Link to post
Share on other sites

I need this for all the grids un the app.

 

Can do this in CSS? in mainform script?

 

Thanks in advance.

Share this post


Link to post
Share on other sites

Hi,

 

H,

 

I do this for dbgrids in run time:

 

   tunidbgrid(xdbg).ClientEvents.unievents.Values['beforeinit']:='function beforeinit(sender, config)' +
             '{config.viewConfig.enableTextSelection = true;}';
 

This don't work.

 

Where do you use this code?

Share this post


Link to post
Share on other sites

in the onshow of the form that contains tje grid

 

Enviado desde mi SM-A500FU mediante Tapatalk

Share this post


Link to post
Share on other sites

I am trying not write this in evwry client event of every dbgrid.

 

 

Enviado desde mi SM-A500FU mediante Tapatalk

Share this post


Link to post
Share on other sites

in the onshow of the form that contains tje grid

 

Enviado desde mi SM-A500FU mediante Tapatalk

 

it should work

Share this post


Link to post
Share on other sites

Or, try this:

 

MainForm -> Script:

Ext.override(Ext.grid.View, { enableTextSelection: true });

Share this post


Link to post
Share on other sites

Great!!

 

Thanks.

 

In mainfor is better.

 

And this?:

 

function containercontextmenu(sender, e, eOpts)
{
  ajaxRequest(this, 'cellcontextmenu', ['ex='+e.getXY()[0], 'ey='+e.getXY()[1]]);
}

 

ths is also for every grid (extevents).

 

Thanks.

Share this post


Link to post
Share on other sites

yes

 

Enviado desde mi SM-A500FU mediante Tapatalk

Share this post


Link to post
Share on other sites

UniDBGrid -> OnCellContextClick event ??

but this don't work if grid is empty.

 

this is the reason of my prior post.

 

is possible to add in mainform script to not repeat in every dbgrid?

 

 

 

Enviado desde mi SM-A500FU mediante Tapatalk

Share this post


Link to post
Share on other sites

but this don't work if grid is empty.

 

Correct, because this applies to cells

 

 

is possible to add in mainform script to not repeat in every dbgrid?

 

Yes, it is possible, but I think, it is better to do this in the "code", for example, in the FormCreate event

Share this post


Link to post
Share on other sites

Sorry. Don't work.

 

But I think it could be better in mainform script, because I do only once, not in every form and/or every dbgrid.

 

How can I do it?

 

Thanks.

Share this post


Link to post
Share on other sites

add the code on form create has no effect in the grid

 

Enviado desde mi SM-A500FU mediante Tapatalk

Share this post


Link to post
Share on other sites

as I can see, in general, add the code in run time to grids, don't work.

 

for this, I think is better to add in mainform script (as you told me with enableTextSelection).

Share this post


Link to post
Share on other sites

as I can see, in general, add the code in run time to grids, don't work.

 

Sorry, provide the code, I will analyze

Share this post


Link to post
Share on other sites

This is the code, in every dbgrid:

 

function containercontextmenu(sender, e, eOpts)
{
  ajaxRequest(this, 'cellcontextmenu', ['ex='+e.getXY()[0], 'ey='+e.getXY()[1]]);
}

 

 

And for not repeat in every one, I'm trying to do this:

 

   tunidbgrid(xdbg).ClientEvents.ExtEvents.Values['containercontextmenu']:='function containercontextmenu(sender, e, eOpts)' +
             '{ajaxRequest(this, cellcontextmenu, [ex=+e.getXY()[0], ey=+e.getXY()[1]]);}';
 

 

As you told me with cellcontextmenu, I'd like to do this in mainform script, and do only once, not in every dbgrid individually.

 

Thanks.

Share this post


Link to post
Share on other sites

procedure TMainForm.UniFormCreate(Sender: TObject);
begin
    UniDBGrid1.ClientEvents.ExtEvents.Values['containercontextmenu']:='function containercontextmenu(sender, e, eOpts)' +
    '{ajaxRequest(this, "_cellcontextmenu", ["ex="+e.getXY()[0], "ey="+e.getXY()[1]]);}';
end;

Share this post


Link to post
Share on other sites

Sorry, but don't work.

 

It does nothing if dbgrid is empty.

Share this post


Link to post
Share on other sites

Sorry, but don't work.

 

It does nothing if dbgrid is empty.

 

 

procedure TMainForm.UniFormCreate(Sender: TObject);
begin
    UniDBGrid1.ClientEvents.ExtEvents.Values['containercontextmenu']:='function containercontextmenu(sender, e, eOpts)' +
    '{ajaxRequest(this, "_cellcontextmenu", ["ex="+e.getXY()[0], "ey="+e.getXY()[1]]);}';
end;
procedure TMainForm.UniDBGrid1AjaxEvent(Sender: TComponent; EventName: string;
  Params: TUniStrings);
begin
  if EventName = '_cellcontextmenu' then
  begin
    ShowMessage('click');
  end;

end;

Share this post


Link to post
Share on other sites

ok. works.

 

but could be better this?:

 

procedure TMainForm.UniDBGrid1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
   if button=mbRight then
      menu.Popup(X, Y, UniDBGrid1);
end;
 

Using MouseDown instead of CellContextClick.

 

Only with this don't need any more. It works without ajaxrequest.

 

Is only a question.

 

Could be this better solution? More clear?

 

Thanks.

Share this post


Link to post
Share on other sites

Hi,

 

With CellContextClick, the event occurs only when the "right button" is clicked

With MouseDown, the event occurs when you press "any button"

Share this post


Link to post
Share on other sites

Ok.

 

I know.

 

And what does it mean? Less performance?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×