In my previous blog I had discussed the ways to change the hyperlink on grid to pop-up a custom page window and added parameters. This functionality enables us to handle the actions for grid items separately. This functionality may be required in case when we need to send some more parameters in URL in window that is being popped out.
What if I want a way to perform the single action against multiple items in a grid? Well, this has been quite efficiently implemented on standard grids where we can perform actions against the record set filtered in grid using Action buttons.
For custom entities we can go ahead and add these action buttons, but what next? The actions that take place afterwards have complicated logic to be implemented. Rest all is fine, but sending an E-mail is one of the most common behaviors that business requirement expects from the custom entity design.
Greytrix had come up with several such custom designs wherein we can perform e-mail sending actions either from list of records in grids or even from entity summary screen after redirecting from Grid. Somehow we didn’t find out the way of allowing users to select only the desired records in grid using checkbox. So whenever we received such request, we went ahead with custom grid with lots of navigational and other process handling headaches, but as well said by somebody “Every problem has solution” we have designed a script to achieve this from standard grid itself.
The below post on Jeff’s blog tickled our minds to try our hands in this.
Basically, what I need to have is the column with checkboxes in grid so that I can select multiple items in grid and perform some actions for them. This cannot be achieved just by adding checkbox field to grid. The above post describes how to refer a grid on page. Now to achieve your requirement you need to do following actions.
1. Add a dummy field to entity named “Select” (This ensures that “Select” comes up as the header of checkbox column.). Let the field be a simple text field.
2. Add it as a first column in the grid you have designed from Lists tab under that entity. Now this will just be an empty column
3. Add a custom jump to some page or action in the column next to the “Select”. This is the location from where we determine the id field for that particular row. Now question is why do we need id value of that row?
Adding checkboxes only won’t achieve our requirement. We want every checkbox to possess unique Id and Name value to uniquely identify each row in grid. We can keep it very simple as “chk_
4. Enhancement to script on above mentioned blog is the below function to add checkboxes on grid.
Note: Please click on image to enlarge
In the above script the Custom Entity is Bill and Id field is Bill_BillId. You need to make changes to script in order reuse it for your entity
5. The script will insert all checkboxes in first column of grid and as we have unique checkbox we can now go ahead to uniquely identify each row in grid.