Get KoolPHP UI with 30% OFF!

Message from Grid Eventhandler

Michael Meyer
Dear all,
how can I return a error message if an event is invalid?
Currently the event handler for koolgrid is set up like:
class MyGridEventHandler extends GridEventHandler
function OnBeforeConfirmInsert($tableview,$args)
//$tableview: The grid tableview object.
//$args["NewDataItem"]: New dataitem
return true;
It returns true or false, but in case of false how can I display a message in grid?
Posted Oct 4 Kool
Anthony Amolochitis
Say I want to insert data, but it fails. I want to keep the data fields populated with the values a user input while leaving the grid in insert mode.
Since insert failed, I can add a javascript window alert message outputting the error message.
I implement this using the insert template as well. It gives me complete control on how I want the grid to behave.
I have some samples I added to the forum if you want to try them.
Posted Oct 8 Kool
Anthony Amolochitis
You can also add messages in the html itself with the grid event handler.
Did you figure it out yet?

I was just curious.
Posted Oct 22 Kool
Michael Meyer
No unfortunately they could not found a solution. I used koolajax to show js alerts instead. Ok, but not perfect...
Posted Oct 22 Kool
Anthony Amolochitis
Well at least you have a start.
I know this is doable since I do it already.
The koolgrid uses koolajax to send and receive data.
When you submit your insert/edit template the server does it's thing and fire events in the koolgrid on server and client.
You can manage all your errors at the server and send packages back with the grid and let the client events fire off and gather the packages of data to produce their messages as needed.
I hope this helps you in your quest to customize your application :)
Take it easy.
Posted Oct 22 Kool