Hello,
Following JS code, will display dropdown with toolbar buttons. It's upto your
logic to show desired options and onchange function. Here 'list1' is grid id.
<script>
jQuery(window).load(function(){
jQuery('#list1_pager_left').append ('<div style="padding-left: 5px; padding-top:2px; float:left"><select><option>None</option></select></div>');
});
</script>
as per your instruction i tried but failed to do so.
Please check the code which i applied to position the Dynamic group by dropdown button in toolbar.
code used to append group by at toolbar
<script>
jQuery(window).load(function(){
jQuery('#list1_pager').append ('<div style="padding-left: 5px; padding-top:2px; float:left"><select id="chngroup">
<option value="clear" >–Select Here–</option>
<?php foreach($cols as $c) {
if($c["title"] !='Action'){
?>
<option value="<?php echo $c["name"] ?>"><?php echo $c["title"] ?></option>
<?php }} ?>
<option value="clear" onChange="frz()">Clear</option>
</select></div>');
});
</script>
First list1_pager will be list1_pager_left, as in my above code.
Second, you need to remove new lines.
Final code will be …
<script>
jQuery(window).load(function()
{
jQuery('#list1_pager_left').append('<div style="padding-left: 5px; padding-top:2px; float:left"><select class="chngroup"><option value="clear" >–Select Group By–</option><?php foreach($cols as $c) { if($c["title"] !='Action'){?><option value="<?php echo $c["name"] ?>"><?php echo $c["title"] ?></option><?php }} ?><option value="clear" onChange="frz()">Clear</option> </select></div>');
jQuery(".chngroup").change(function()
{
var vl = jQuery(this).val();
if(vl)
{
if(vl == "clear")
jQuery("#<?php echo $grid_id ?>").jqGrid('groupingRemove',true);
else
jQuery("#<?php echo $grid_id ?>").jqGrid('groupingGroupBy',vl);
}
});
});
</script>
I'm also emailing you sample code.