I did added one editable field in my custom module grid.it display textbox but when i tick the checkbox and change the textbox value i can't get it in post data.
admin grid form code
$this->addColumn('banner_position', array(
'header' => Mage::helper('banner')->__('Position'),
'align' =>'left',
'index' => 'banner_position',
'editable' => true,
'edit_only' => true,
));
Screenshot
Can anyone please guide me on this
Related
How to remove content limit from grid column.i have long text to display it in grid but when display it subtract the string.i want to show full text in the grid.
Ok Found solution just add string_limit in addcolumn or addColumnAfter function in grid.php
$this->addColumnAfter('addons', array(
'header' => Mage::helper('sales')->__('Addons'),
'filter' => false,
'sortable' => false,
'index' => 'addons',
'type' => 'text',
'string_limit' => '500', /* added for content limit */
), 'billing_name');
I created a new module and I managed to list all the orders from the shop.
I also added a button (with this code).
$link= Mage::helper('adminhtml')->getUrl('adminhtml/order/sync/') .'id/$entity_id';
$this->addColumn('action_edit', array(
'header' => $this->helper('catalog')->__('Action'),
'width' => 15,
'sortable' => false,
'filter' => false,
'type' => 'action',
'actions' => array(
array(
'url' => $link,
'caption' => $this->helper('catalog')->__('Sync'),
),
)
));
I really don't know how to assign an action to this button. What I should create in my custom module ? A new controller?
I need to display something or get some data when I click this button...
thank you very much
I think you should write
public function YourActionNameAction()
{
}
in your Module controller file
I created new magento grid for customer module for special purpose.
In that there have a column usertype it have value as 0,1,2.
It will displayed in customer grid page as 0,1,2.
But i need to display if value is,
0 -> Inactive
1 -> Activated
2 -> Baned
How can i dothis?
This is my code grid.php in _prepareColumns() :
$this->addColumn('usertype', array(
'header' => Mage::helper('customer')->__('Usertype'),
'width' => '150',
'index' => 'usertype'
));
If this is possible in magento.
if your greed implements Mage_Adminhtml_Block_Widget_Grid I suggest you to modify
you addColumn call to
$this->addColumn('usertype',
array(
'header'=> Mage::helper('customer')->__('Usertype'),
'width' => '150px',
'index' => 'usertype',
'type' => 'options',
'options' => $values
));
Where $values should be formatted as
array( 'value_id' => 'value_label')
Now you have dropdown created with values.
Then update _prepareCollection() function and add attribute values to customer grid collection
$collection->joinAttribute('usertype', 'customer/usertype', 'entity_id', null, 'left');
I got the solution from this
By using rendere will help to load vlaues to each row.
I'm trying to write a custom action to run off of an admin grid that I have built. Is it possible to send a value from a column in the grid to the controller via either get or post?
I've tried googling, but I cannot find a proper explanation for this anywhere. A link to an explanation of the column settings ('getter', 'type' etc.) would also be useful if this is available.
Add this code to your Grid.php:
$this->addColumn('action',
array(
'header' => Mage::helper('yourmodulename')->__('Action'),
'width' => '100',
'type' => 'action',
'getter' => 'getId',
'actions' => array(
array(
'caption' => Mage::helper('yourmodulename')->__('Edit'),
'url' => array('base'=> '*/*/edit'),
'field' => 'id'
)
),
'filter' => false,
'sortable' => false,
'index' => 'stores',
'is_system' => true,
));
That will build an "Edit" URL with the Id of the selected row as part of the URL. It will look something like <frontname>/<controllername>/edit/id/<value> where value is returned by the getter getId().
The getter field will execute any of the standard Magento magic getters, ie any attribute is gettable. So you could have getName or getProductUrl or getIsLeftHanded if you wanted and your controller can parse the attribute.
The controller can then retrieve that passed value using Mage::app()->getRequest()->getParam('attributename');
In terms of documentation/tutorials, have a read of this article on the website of #AlanStorm as it might help.
HTH,
JD
I am working on a custom module in magento admin that uses the ‘sales/order_grid_collection’ class to show the grid of all orders. The grid appears fine.
However, the first column of the grid is of ‘increment_id’, unlike the actual orders grid where the first column has checkboxes for mass action. I am getting this in spite having copy-pasted almost all the code for the _prepareColumns method from the original order module.
So I tried adding a first column of checkboxes manually inside the _prepareColumns method as follows
$this->addColumn('order_id', array(
'header_css_class' => 'a-center',
'header' => Mage::helper('sales')->__('Assigned'),
'type' => 'checkbox',
'width' => '20px',
'field_name' => 'orders[]',
'align' => 'center',
'renderer' => new Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Checkbox(),
'index' => 'order_id'
));
Upon doing this, the chekboxes do appear but they are disabled.
What am I missing here ?
Thanks
What shows up the checkboxes for mass action is the _prepareMassaction() method (see for example Mage_Adminhtml_Block_Sales_Order_Grid line 151-199 on v1.5), do you copy-pasted also in your Namespace_Module_Block_Adminhtml_Yourpath_Grid class?
If so, please paste it here to see if there is something wrong about it