multiple collections in one admin grid?
Is it possible to have multiple collections in one grid? Suppose if we have grouped data, and we need to display it in multiple dynamic child grids.
Suppose data is:
firstname lastname city
Group 1:
mark james new york
mark james new york
Group 2:
mark james california
mark james california
Group 3 :
aston wright france
aston liam france
Is it possible?
adminhtml collection grid
add a comment |
Is it possible to have multiple collections in one grid? Suppose if we have grouped data, and we need to display it in multiple dynamic child grids.
Suppose data is:
firstname lastname city
Group 1:
mark james new york
mark james new york
Group 2:
mark james california
mark james california
Group 3 :
aston wright france
aston liam france
Is it possible?
adminhtml collection grid
os is it possible to pass parameter(collection) in controller and looping the admin grid to get multiple grids on same page?
– Guru
Jun 27 '13 at 18:24
How do you group the collection? It is loaded from one table? If collection items is loaded from one table and you want to display them as grouped visually, it is not too hard task. Please, clarify your situation more.
– mageUz
Jun 28 '13 at 7:54
Thanks mageUz. please check this code$collections =Mage::getSingleton('mergeaccount/data')->getGroups();$collection_of_things = new Varien_Data_Collection();foreach($collections as $collection) {$collection_of_things->addItem($collection);}$this->setCollection($collection_of_things);return parent::_prepareCollection(); where $collections is array of Mage::getModel('customer/customer')->getCollection()->addFieldToFilter($attributenames[0], array('eq'=>$arrrayData[$k][$attributenames[0]]));
– Guru
Jun 28 '13 at 14:31
Above code gives me error "it gives error "Fatal error: Call to a member function append() on a non-object". Please let me know where am i going wrong? Thanks again :)
– Guru
Jun 28 '13 at 14:31
add a comment |
Is it possible to have multiple collections in one grid? Suppose if we have grouped data, and we need to display it in multiple dynamic child grids.
Suppose data is:
firstname lastname city
Group 1:
mark james new york
mark james new york
Group 2:
mark james california
mark james california
Group 3 :
aston wright france
aston liam france
Is it possible?
adminhtml collection grid
Is it possible to have multiple collections in one grid? Suppose if we have grouped data, and we need to display it in multiple dynamic child grids.
Suppose data is:
firstname lastname city
Group 1:
mark james new york
mark james new york
Group 2:
mark james california
mark james california
Group 3 :
aston wright france
aston liam france
Is it possible?
adminhtml collection grid
adminhtml collection grid
edited 39 mins ago
Teja Bhagavan Kollepara
2,94841847
2,94841847
asked Jun 27 '13 at 18:20
GuruGuru
148321
148321
os is it possible to pass parameter(collection) in controller and looping the admin grid to get multiple grids on same page?
– Guru
Jun 27 '13 at 18:24
How do you group the collection? It is loaded from one table? If collection items is loaded from one table and you want to display them as grouped visually, it is not too hard task. Please, clarify your situation more.
– mageUz
Jun 28 '13 at 7:54
Thanks mageUz. please check this code$collections =Mage::getSingleton('mergeaccount/data')->getGroups();$collection_of_things = new Varien_Data_Collection();foreach($collections as $collection) {$collection_of_things->addItem($collection);}$this->setCollection($collection_of_things);return parent::_prepareCollection(); where $collections is array of Mage::getModel('customer/customer')->getCollection()->addFieldToFilter($attributenames[0], array('eq'=>$arrrayData[$k][$attributenames[0]]));
– Guru
Jun 28 '13 at 14:31
Above code gives me error "it gives error "Fatal error: Call to a member function append() on a non-object". Please let me know where am i going wrong? Thanks again :)
– Guru
Jun 28 '13 at 14:31
add a comment |
os is it possible to pass parameter(collection) in controller and looping the admin grid to get multiple grids on same page?
– Guru
Jun 27 '13 at 18:24
How do you group the collection? It is loaded from one table? If collection items is loaded from one table and you want to display them as grouped visually, it is not too hard task. Please, clarify your situation more.
– mageUz
Jun 28 '13 at 7:54
Thanks mageUz. please check this code$collections =Mage::getSingleton('mergeaccount/data')->getGroups();$collection_of_things = new Varien_Data_Collection();foreach($collections as $collection) {$collection_of_things->addItem($collection);}$this->setCollection($collection_of_things);return parent::_prepareCollection(); where $collections is array of Mage::getModel('customer/customer')->getCollection()->addFieldToFilter($attributenames[0], array('eq'=>$arrrayData[$k][$attributenames[0]]));
– Guru
Jun 28 '13 at 14:31
Above code gives me error "it gives error "Fatal error: Call to a member function append() on a non-object". Please let me know where am i going wrong? Thanks again :)
– Guru
Jun 28 '13 at 14:31
os is it possible to pass parameter(collection) in controller and looping the admin grid to get multiple grids on same page?
– Guru
Jun 27 '13 at 18:24
os is it possible to pass parameter(collection) in controller and looping the admin grid to get multiple grids on same page?
– Guru
Jun 27 '13 at 18:24
How do you group the collection? It is loaded from one table? If collection items is loaded from one table and you want to display them as grouped visually, it is not too hard task. Please, clarify your situation more.
– mageUz
Jun 28 '13 at 7:54
How do you group the collection? It is loaded from one table? If collection items is loaded from one table and you want to display them as grouped visually, it is not too hard task. Please, clarify your situation more.
– mageUz
Jun 28 '13 at 7:54
Thanks mageUz. please check this code$collections =Mage::getSingleton('mergeaccount/data')->getGroups();$collection_of_things = new Varien_Data_Collection();foreach($collections as $collection) {$collection_of_things->addItem($collection);}$this->setCollection($collection_of_things);return parent::_prepareCollection(); where $collections is array of Mage::getModel('customer/customer')->getCollection()->addFieldToFilter($attributenames[0], array('eq'=>$arrrayData[$k][$attributenames[0]]));
– Guru
Jun 28 '13 at 14:31
Thanks mageUz. please check this code$collections =Mage::getSingleton('mergeaccount/data')->getGroups();$collection_of_things = new Varien_Data_Collection();foreach($collections as $collection) {$collection_of_things->addItem($collection);}$this->setCollection($collection_of_things);return parent::_prepareCollection(); where $collections is array of Mage::getModel('customer/customer')->getCollection()->addFieldToFilter($attributenames[0], array('eq'=>$arrrayData[$k][$attributenames[0]]));
– Guru
Jun 28 '13 at 14:31
Above code gives me error "it gives error "Fatal error: Call to a member function append() on a non-object". Please let me know where am i going wrong? Thanks again :)
– Guru
Jun 28 '13 at 14:31
Above code gives me error "it gives error "Fatal error: Call to a member function append() on a non-object". Please let me know where am i going wrong? Thanks again :)
– Guru
Jun 28 '13 at 14:31
add a comment |
1 Answer
1
active
oldest
votes
You may add several grids to the page.
Otherwise you will need to create some sort of compound collection in _prepareCollection method. In this case, you'd better create some new model which would be dealing with data.
Thanks for the answer. Could you please explain little more. i used this code but it did not work ( i used loop to set collections) $collections =Mage::getSingleton('mergeaccount/data')->getGroups(); foreach($collections as $collection) { $this->setCollection($collection); } return parent::_prepareCollection(); Could you please paste code for compound collection? and also is it possible to pass parameters from controller and iterate grid block in controller? Thanks in advance:)
– Guru
Jun 27 '13 at 21:28
could someone explain it little more? if possible with an exmaple. Thanks a lot :)
– Guru
Jun 28 '13 at 5:44
In your example $this->setCollection($collection) will use only data from last one. You need to combine them though. If your data are in different tables you will probably need to add them into Varien_Data_Collection object with addItem. Item to be added is Varien_Object. So you do$item = new Varien_Object()
, then$item->addData($arr)
and$varienCollection->addItem($item)
. Something like this. That all should be done in you model, where you take your data from various sources and create new collection.
– Taras
Jun 28 '13 at 11:17
this link may help.
– Taras
Jun 28 '13 at 11:43
Thanks again for the answer. i used this code. $collections =Mage::getSingleton('mergeaccount/data')->getGroups();$collection_of_things = new Varien_Data_Collection();foreach($collections as $collection) {$collection_of_things->addItem($collection);}$this->setCollection($collection_of_things);return parent::_prepareCollection(); where $collections is array of Mage::getModel('customer/customer')->getCollection()->addFieldToFilter($attributenames[0], array('eq'=>$arrrayData[$k][$attributenames[0]]));
– Guru
Jun 28 '13 at 13:45
|
show 11 more comments
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "479"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f5222%2fmultiple-collections-in-one-admin-grid%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You may add several grids to the page.
Otherwise you will need to create some sort of compound collection in _prepareCollection method. In this case, you'd better create some new model which would be dealing with data.
Thanks for the answer. Could you please explain little more. i used this code but it did not work ( i used loop to set collections) $collections =Mage::getSingleton('mergeaccount/data')->getGroups(); foreach($collections as $collection) { $this->setCollection($collection); } return parent::_prepareCollection(); Could you please paste code for compound collection? and also is it possible to pass parameters from controller and iterate grid block in controller? Thanks in advance:)
– Guru
Jun 27 '13 at 21:28
could someone explain it little more? if possible with an exmaple. Thanks a lot :)
– Guru
Jun 28 '13 at 5:44
In your example $this->setCollection($collection) will use only data from last one. You need to combine them though. If your data are in different tables you will probably need to add them into Varien_Data_Collection object with addItem. Item to be added is Varien_Object. So you do$item = new Varien_Object()
, then$item->addData($arr)
and$varienCollection->addItem($item)
. Something like this. That all should be done in you model, where you take your data from various sources and create new collection.
– Taras
Jun 28 '13 at 11:17
this link may help.
– Taras
Jun 28 '13 at 11:43
Thanks again for the answer. i used this code. $collections =Mage::getSingleton('mergeaccount/data')->getGroups();$collection_of_things = new Varien_Data_Collection();foreach($collections as $collection) {$collection_of_things->addItem($collection);}$this->setCollection($collection_of_things);return parent::_prepareCollection(); where $collections is array of Mage::getModel('customer/customer')->getCollection()->addFieldToFilter($attributenames[0], array('eq'=>$arrrayData[$k][$attributenames[0]]));
– Guru
Jun 28 '13 at 13:45
|
show 11 more comments
You may add several grids to the page.
Otherwise you will need to create some sort of compound collection in _prepareCollection method. In this case, you'd better create some new model which would be dealing with data.
Thanks for the answer. Could you please explain little more. i used this code but it did not work ( i used loop to set collections) $collections =Mage::getSingleton('mergeaccount/data')->getGroups(); foreach($collections as $collection) { $this->setCollection($collection); } return parent::_prepareCollection(); Could you please paste code for compound collection? and also is it possible to pass parameters from controller and iterate grid block in controller? Thanks in advance:)
– Guru
Jun 27 '13 at 21:28
could someone explain it little more? if possible with an exmaple. Thanks a lot :)
– Guru
Jun 28 '13 at 5:44
In your example $this->setCollection($collection) will use only data from last one. You need to combine them though. If your data are in different tables you will probably need to add them into Varien_Data_Collection object with addItem. Item to be added is Varien_Object. So you do$item = new Varien_Object()
, then$item->addData($arr)
and$varienCollection->addItem($item)
. Something like this. That all should be done in you model, where you take your data from various sources and create new collection.
– Taras
Jun 28 '13 at 11:17
this link may help.
– Taras
Jun 28 '13 at 11:43
Thanks again for the answer. i used this code. $collections =Mage::getSingleton('mergeaccount/data')->getGroups();$collection_of_things = new Varien_Data_Collection();foreach($collections as $collection) {$collection_of_things->addItem($collection);}$this->setCollection($collection_of_things);return parent::_prepareCollection(); where $collections is array of Mage::getModel('customer/customer')->getCollection()->addFieldToFilter($attributenames[0], array('eq'=>$arrrayData[$k][$attributenames[0]]));
– Guru
Jun 28 '13 at 13:45
|
show 11 more comments
You may add several grids to the page.
Otherwise you will need to create some sort of compound collection in _prepareCollection method. In this case, you'd better create some new model which would be dealing with data.
You may add several grids to the page.
Otherwise you will need to create some sort of compound collection in _prepareCollection method. In this case, you'd better create some new model which would be dealing with data.
answered Jun 27 '13 at 20:50
TarasTaras
512
512
Thanks for the answer. Could you please explain little more. i used this code but it did not work ( i used loop to set collections) $collections =Mage::getSingleton('mergeaccount/data')->getGroups(); foreach($collections as $collection) { $this->setCollection($collection); } return parent::_prepareCollection(); Could you please paste code for compound collection? and also is it possible to pass parameters from controller and iterate grid block in controller? Thanks in advance:)
– Guru
Jun 27 '13 at 21:28
could someone explain it little more? if possible with an exmaple. Thanks a lot :)
– Guru
Jun 28 '13 at 5:44
In your example $this->setCollection($collection) will use only data from last one. You need to combine them though. If your data are in different tables you will probably need to add them into Varien_Data_Collection object with addItem. Item to be added is Varien_Object. So you do$item = new Varien_Object()
, then$item->addData($arr)
and$varienCollection->addItem($item)
. Something like this. That all should be done in you model, where you take your data from various sources and create new collection.
– Taras
Jun 28 '13 at 11:17
this link may help.
– Taras
Jun 28 '13 at 11:43
Thanks again for the answer. i used this code. $collections =Mage::getSingleton('mergeaccount/data')->getGroups();$collection_of_things = new Varien_Data_Collection();foreach($collections as $collection) {$collection_of_things->addItem($collection);}$this->setCollection($collection_of_things);return parent::_prepareCollection(); where $collections is array of Mage::getModel('customer/customer')->getCollection()->addFieldToFilter($attributenames[0], array('eq'=>$arrrayData[$k][$attributenames[0]]));
– Guru
Jun 28 '13 at 13:45
|
show 11 more comments
Thanks for the answer. Could you please explain little more. i used this code but it did not work ( i used loop to set collections) $collections =Mage::getSingleton('mergeaccount/data')->getGroups(); foreach($collections as $collection) { $this->setCollection($collection); } return parent::_prepareCollection(); Could you please paste code for compound collection? and also is it possible to pass parameters from controller and iterate grid block in controller? Thanks in advance:)
– Guru
Jun 27 '13 at 21:28
could someone explain it little more? if possible with an exmaple. Thanks a lot :)
– Guru
Jun 28 '13 at 5:44
In your example $this->setCollection($collection) will use only data from last one. You need to combine them though. If your data are in different tables you will probably need to add them into Varien_Data_Collection object with addItem. Item to be added is Varien_Object. So you do$item = new Varien_Object()
, then$item->addData($arr)
and$varienCollection->addItem($item)
. Something like this. That all should be done in you model, where you take your data from various sources and create new collection.
– Taras
Jun 28 '13 at 11:17
this link may help.
– Taras
Jun 28 '13 at 11:43
Thanks again for the answer. i used this code. $collections =Mage::getSingleton('mergeaccount/data')->getGroups();$collection_of_things = new Varien_Data_Collection();foreach($collections as $collection) {$collection_of_things->addItem($collection);}$this->setCollection($collection_of_things);return parent::_prepareCollection(); where $collections is array of Mage::getModel('customer/customer')->getCollection()->addFieldToFilter($attributenames[0], array('eq'=>$arrrayData[$k][$attributenames[0]]));
– Guru
Jun 28 '13 at 13:45
Thanks for the answer. Could you please explain little more. i used this code but it did not work ( i used loop to set collections) $collections =Mage::getSingleton('mergeaccount/data')->getGroups(); foreach($collections as $collection) { $this->setCollection($collection); } return parent::_prepareCollection(); Could you please paste code for compound collection? and also is it possible to pass parameters from controller and iterate grid block in controller? Thanks in advance:)
– Guru
Jun 27 '13 at 21:28
Thanks for the answer. Could you please explain little more. i used this code but it did not work ( i used loop to set collections) $collections =Mage::getSingleton('mergeaccount/data')->getGroups(); foreach($collections as $collection) { $this->setCollection($collection); } return parent::_prepareCollection(); Could you please paste code for compound collection? and also is it possible to pass parameters from controller and iterate grid block in controller? Thanks in advance:)
– Guru
Jun 27 '13 at 21:28
could someone explain it little more? if possible with an exmaple. Thanks a lot :)
– Guru
Jun 28 '13 at 5:44
could someone explain it little more? if possible with an exmaple. Thanks a lot :)
– Guru
Jun 28 '13 at 5:44
In your example $this->setCollection($collection) will use only data from last one. You need to combine them though. If your data are in different tables you will probably need to add them into Varien_Data_Collection object with addItem. Item to be added is Varien_Object. So you do
$item = new Varien_Object()
, then $item->addData($arr)
and $varienCollection->addItem($item)
. Something like this. That all should be done in you model, where you take your data from various sources and create new collection.– Taras
Jun 28 '13 at 11:17
In your example $this->setCollection($collection) will use only data from last one. You need to combine them though. If your data are in different tables you will probably need to add them into Varien_Data_Collection object with addItem. Item to be added is Varien_Object. So you do
$item = new Varien_Object()
, then $item->addData($arr)
and $varienCollection->addItem($item)
. Something like this. That all should be done in you model, where you take your data from various sources and create new collection.– Taras
Jun 28 '13 at 11:17
this link may help.
– Taras
Jun 28 '13 at 11:43
this link may help.
– Taras
Jun 28 '13 at 11:43
Thanks again for the answer. i used this code. $collections =Mage::getSingleton('mergeaccount/data')->getGroups();$collection_of_things = new Varien_Data_Collection();foreach($collections as $collection) {$collection_of_things->addItem($collection);}$this->setCollection($collection_of_things);return parent::_prepareCollection(); where $collections is array of Mage::getModel('customer/customer')->getCollection()->addFieldToFilter($attributenames[0], array('eq'=>$arrrayData[$k][$attributenames[0]]));
– Guru
Jun 28 '13 at 13:45
Thanks again for the answer. i used this code. $collections =Mage::getSingleton('mergeaccount/data')->getGroups();$collection_of_things = new Varien_Data_Collection();foreach($collections as $collection) {$collection_of_things->addItem($collection);}$this->setCollection($collection_of_things);return parent::_prepareCollection(); where $collections is array of Mage::getModel('customer/customer')->getCollection()->addFieldToFilter($attributenames[0], array('eq'=>$arrrayData[$k][$attributenames[0]]));
– Guru
Jun 28 '13 at 13:45
|
show 11 more comments
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f5222%2fmultiple-collections-in-one-admin-grid%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
os is it possible to pass parameter(collection) in controller and looping the admin grid to get multiple grids on same page?
– Guru
Jun 27 '13 at 18:24
How do you group the collection? It is loaded from one table? If collection items is loaded from one table and you want to display them as grouped visually, it is not too hard task. Please, clarify your situation more.
– mageUz
Jun 28 '13 at 7:54
Thanks mageUz. please check this code$collections =Mage::getSingleton('mergeaccount/data')->getGroups();$collection_of_things = new Varien_Data_Collection();foreach($collections as $collection) {$collection_of_things->addItem($collection);}$this->setCollection($collection_of_things);return parent::_prepareCollection(); where $collections is array of Mage::getModel('customer/customer')->getCollection()->addFieldToFilter($attributenames[0], array('eq'=>$arrrayData[$k][$attributenames[0]]));
– Guru
Jun 28 '13 at 14:31
Above code gives me error "it gives error "Fatal error: Call to a member function append() on a non-object". Please let me know where am i going wrong? Thanks again :)
– Guru
Jun 28 '13 at 14:31