As we have already known, PHPMaker has the ability to generate the List pages that contain Search panel which has either collapsed or expanded as the initial state when the List pages are loaded. You have to choose one of those two conditions before generating the List pages. When you choose Initiate search panel as collapsed from Advanced Settings of PHPMaker application, then this Search Panel will always be collapsed, even your web application users have defined the search criteria into it before; either in Basic Search or Advanced Search.
This following customization will make the ability to automatically expanding the Search Panel in List pages if users have defined or entered the search criteria, either from Basic Search or Advanced Search. This is very useful to make your web applications will look more professional, since this will make your users easier while they are using the Search features, so they don't have to expand the Search Panel after defining the search criteria, especially when you set it up collapsed as the initial state. It does more make sense to expand the Search Panel when your users have defined the Search Criteria instead of keeping it collapsed all the time.
Important: Since this following customization is related to the following articles:
- How to Customize Search Panel Style in Websites that Created With PHPMaker 9.0.1
- How to Add jQuery slideDown and slideUp Effects into the Search Panel in Websites that Created with PHPMaker 9.0.1
then you have to implement the customizations in those two articles above before implementing the customization below.
Updated on November 29, 2012: This customization has been implemented in PHPMaker version 9.1.0, it matches to each other, and as a result, it works properly.
Updated on February 10, 2013: This customization has been implemented in PHPMaker version 9.2.0, it matches to each other, and as a result, it works properly.
[hidepost]
-
Open your \Script\ew_addon.js file, and find this code:
<!--## } ##--> <!--##/session##--> <!--##session js_local_end##--> </script> <!--##/session##-->
before the first line of that code, please insert the following code:
<?php // Begin of modification Always Expanded if Search Where is not blank, by Masino Sinaga, November 4, 2012 ?> <?php if ($<!--##=sPageObj##-->->getSearchWhere() != "") { // Always expanded if there is search criteria defined by end-user ?> $(document).ready(function() { $("a#searchPanelAnchor").html('<img src="phpimages/collapse.gif" alt="" width="9" height="9" border="0">'); $('div#<!--##=sFormNameSearch##-->_SearchPanel').show(); }); <?php } ?> <?php // End of modification Always Expanded if Search Where is not blank, by Masino Sinaga, November 4, 2012 ?> -
In order to see and test the result after generating the script files later, it is recommended to set the Search Panel as collapsed. To do this, find this code in the \Script\ewcfg.php file (you should find the following code if only you have implemented the modification from the two articles above):
define("MS_SEARCH_PANEL_COLLAPSED", FALSE, TRUE); // Whether to collaps or expand the search panelthen replace it with the following code:
define("MS_SEARCH_PANEL_COLLAPSED", TRUE, TRUE); // default as Collapsed - Finally, re-generate your script files using PHPMaker as always.
[/hidepost]
Another great mod… Small issue I’m having is that this seems to work perfectly when using Firefox but DOES NOT work on IE9.
I just tested it on IE9 and it works properly.