How to Add Store View Selector in Custom Admin Grid Module – Magento 1.9

admingridmagento-1.9

How can I add the Store view selector in my custom admin grid module![enter image description here][1]

I added this in my layout now its comming in my grid now to save store wise grid information in to database

Thanks in advance

Best Answer

Essentially you need to add the xml for your layout file, e.g.:

        <block type="adminhtml/store_switcher" name="store_switcher" as="store_switcher">
            <action method="setUseConfirm">
                <params>0</params>
            </action>
        </block>

Then the usual getChildHtml in template:

<?php echo $this->getChildHtml('store_switcher');?>

Without knowing the specifics of your module and layout xml it is hard to say how that works out for you in the backend. However, see this question where @Marius explains how to pick up the store id:

https://magento.stackexchange.com/a/17190/12662