Jump to content

Recommended Posts

Posted

Help, my first trial at ExtEvents is failing completely - what am I doing wrong??
 
Im trying to route a simple celllick client event of my uniDBGrid to my OnAjaxEvent function, and when I load the grid in the browser I get an Ajax error message as seen in the screenshot.
 

image02.jpg

 
uniDBGrid ExtEvents:
function cellclick(sender, td, cellIndex, record, tr, rowIndex, e, eOpts)
{
  ajaxRequest(sender, "cellclick", []);
}
 
Delphi:
procedure TMainForm.uniMasterAjaxEvent(Sender: TComponent; EventName: string; Params: TStrings);
begin
  MessageDlg(params.Text, mtInformation, [])
end;
Posted

  • In your onAjaxEvent, you must test your EventName (ex : if EventName='cellclick' then MessageDlg...)

You don't send any parameter to your AjaxEvent (in your ExtEvent, you wrote : []), so you cannot show params.Text (which will be empty).

Posted

It's really frustrating. As soon as I assign any ExtEvents to my uniDBGrid, I get the ajax error "a is undefined".

 

Does anyone have a clue what I am missing or doing wrong?

Posted

ok, apaprently the "if EventName = .." statement is mandatory. Didn't know this had an effect on client side as well.

 

Thanx!
 

Posted

I have to reopen this thread due to a question concerning general understanding:

 

If I click on the uniDBGrid Header in the browser, and deselect a column, a "columnhide" event is correctly fired.

 

However, in my server side AjaxEvent, the corresponding column is still marked as visible (Columns.Items[ix].Visible = true). Is this correct? Are the client sided property changes not propagated to the server grid columns?

Posted

The sender is conveyed correctly to my AjaxEvent (I used "Mainform.Grid" as sender), but it (the server) does not know yet that the column has been de/selected by the user.

 

Does this info come at a later time? How/when is this info conveyed from the browser to the server? The other way around, if I de/select the column from code (column.visible:= ...), everything is displayed correctly.

  • Administrators
Posted

The sender is conveyed correctly to my AjaxEvent (I used "Mainform.Grid" as sender), but it (the server) does not know yet that the column has been de/selected by the user.

 

Does this info come at a later time? How/when is this info conveyed from the browser to the server? The other way around, if I de/select the column from code (column.visible:= ...), everything is displayed correctly.

 

I failed to understand what you want to achieve by using ajaxEvent.

Posted
Hi Michael Schindler.

 

Try:



uniDBGrid1 ExtEvents:


function cellclick(sender, td, cellIndex, record, tr, rowIndex, e, eOpts)
{  
ajaxRequest(this, 'cellclick', []);
}



procedure TMainForm.UniDBGrid1AjaxEvent(Sender: TComponent; EventName: string;
  Params: TStrings);
begin
  if EventName = 'cellclick' then ShowMessage('cellclick');
end;


  • Upvote 1
Posted

@ Farshad

 

The Ajax error message was already solved. This I conveyed above through:
 

ok, apaprently the "if EventName = .." statement is mandatory. Didn't know this had an effect on client side as well.

 

I reopened the thread above, because I had another problem / bug (I should have created a new thread, sorry):

 

 

If I click on the uniDBGrid Header in the browser, and deselect a column, a "columnhide" event is correctly fired.

However, in my server side AjaxEvent, the corresponding column is still marked as visible (Columns.Items[ix].Visible = true). Is this correct? Are the client sided property changes not propagated to the server grid columns?

 

 

So, in other words: I want to catch a users column de/seletion on the server side. The only event I could find was (likewise for columnshow):

function columnhide(ct, column, eOpts)
{
  ajaxRequest(MainForm.uniDetail, "columnhide", []);
}

My problem is: the event IS fired, when a user hides a column. However, column.visible is still true on the server side!

 

Does that make it clearer?

  • Administrators
Posted

My problem is: the event IS fired, when a user hides a column. However, column.visible is still true on the server side!

 

uniGUI doesn't mark manually hidden columns as invisible. Hiding columns in client side is a visual only effect.

  • Administrators
Posted

However, in my server side AjaxEvent, the corresponding column is still marked as visible (Columns.Items[ix].Visible = true). Is this correct? Are the client sided property changes not propagated to the server grid columns?

 

No, currently those events aren't propagated. It is in todo list.

Posted

I now tried querying the visible/invisible property through the AjaxEvent, like this:

 

function columnhide(ct, column, eOpts)
{
  ajaxRequest(MainForm.uniGrid, "columnhide", ["column=" + column.getIndex(), "visible=" + column.isHidden()]);
}

 

The result is: "column=-1, visible=true" no matter which column I click.

What am I doing wrong, or is this a bug?

Posted

Thank you, Farshad. One small correction:

  ajaxRequest(MainForm.uniGrid, "columnhide", ["column=" + column.dataIndex, "hidden=" + column.hidden]);

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...