misc Posted February 6, 2014 Posted February 6, 2014 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. 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; Quote
ZigZig Posted February 6, 2014 Posted February 6, 2014 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). Quote
misc Posted February 6, 2014 Author Posted February 6, 2014 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? Quote
misc Posted February 6, 2014 Author Posted February 6, 2014 @ZigZag: the error is client side. It comes whether I pass parameters or not. I don't even get to my AjaxEvent... Quote
misc Posted February 6, 2014 Author Posted February 6, 2014 ok, apaprently the "if EventName = .." statement is mandatory. Didn't know this had an effect on client side as well. Thanx! Quote
misc Posted February 6, 2014 Author Posted February 6, 2014 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? Quote
Administrators Farshad Mohajeri Posted February 6, 2014 Administrators Posted February 6, 2014 sender must be an Ext JS component. Try sender.grid Quote
misc Posted February 6, 2014 Author Posted February 6, 2014 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. Quote
Administrators Farshad Mohajeri Posted February 7, 2014 Administrators Posted February 7, 2014 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. Quote
Sherzod Posted February 7, 2014 Posted February 7, 2014 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; 1 Quote
misc Posted February 9, 2014 Author Posted February 9, 2014 @ 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? Quote
Administrators Farshad Mohajeri Posted February 9, 2014 Administrators Posted February 9, 2014 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. Quote
Administrators Farshad Mohajeri Posted February 9, 2014 Administrators Posted February 9, 2014 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. Quote
misc Posted February 9, 2014 Author Posted February 9, 2014 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? Quote
Administrators Farshad Mohajeri Posted February 10, 2014 Administrators Posted February 10, 2014 ajaxRequest(MainForm.uniGrid, "columnhide", ["column=" + column.dataIndex, "hidden=" + column.isHidden()]); Quote
misc Posted February 10, 2014 Author Posted February 10, 2014 Thank you, Farshad. One small correction: ajaxRequest(MainForm.uniGrid, "columnhide", ["column=" + column.dataIndex, "hidden=" + column.hidden]); Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.