Get KoolPHP UI with 30% OFF!

Making use of class constants to set Koolgrid values for grid events

Anthony Amolochitis
Instead of typing out string values for a grid every time, I like to use my IDE to access class methods, constants, etc..., to input these values.
These can are the same every time, so reuse it.
Here is a sample of how you can take advantage of this with KoolGrid client events.
class KoolGridClientEvent
{   
    const OnGridLoad       = 'OnLoad'         ;
    const OnGridInitialize = 'OnInit'           ;
    const OnBeforeDetailTableCollapse   = 'OnBeforeDetailTableCollapse' ;
    const OnDetailTableCollapse         = 'OnDetailTableCollapse';
    
    const OnBeforePageChange = 'OnBeforePageChange';
    
    const OnRowDelete      = 'OnRowDelete'    ;    
    const OnRowSelect      = 'OnRowSelect'    ;
    const OnRowDeselect    = 'OnRowDeselect'  ;
    
    const OnRowCancelEdit  = 'OnRowCancelEdit';
    const OnRowConfirmEdit = 'OnRowConfirmEdit' ;
    
    const OnCancelInsert   = 'OnCancelInsert' ;
    const OnConfirmInsert  = 'OnConfirmInsert';
}

Then, when you set up your client events on the grid, you can do it this way.
 ... 
            $this->KoolGrid->ClientSettings->ClientEvents[KoolGridClientEvent::OnRowSelect]     = "Handle_OnRowSelectTrackingWebLeadOrderSetup";
            $this->KoolGrid->ClientSettings->ClientEvents[KoolGridClientEvent::OnConfirmInsert] = "Handle_WebLeadOrderSetupValidation";
            $this->KoolGrid->ClientSettings->ClientEvents[KoolGridClientEvent::OnCancelInsert]  = "Handle_WebLeadOrderSetupValidation";
 ...
Posted Dec 18, 2015 Kool -
Peter
Thanks Anthony, this is a good suggestion because developers can utilize the Intellisense of code editor.
Posted Dec 19, 2015 Kool
Anthony Amolochitis
Yes indeed. I make use of intellisense, and inheritance, etc... Object orientation will make things easier to code.
I will post more helpful hints along the way. I hope people like them.
Posted Dec 19, 2015 Kool -