Who to add a dopo down list button in toolbar.

QuestionsWho to add a dopo down list button in toolbar.

Hi,
Is it possible to put a drop down button in php grid tool bar.

3 Answers
Abu Ghufran answered 11 years ago

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>

Abu Ghufran answered 11 years ago

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.

Your Answer

7 + 16 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?