Jump to content

ajaxRequest in uniDBGrid event failing


misc
 Share

Recommended Posts

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;
Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • Administrators

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.

Link to comment
Share on other sites

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
Link to comment
Share on other sites

@ 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?

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

 Share

×
×
  • Create New...