How to add a link in a grid column if the records are not found The 2019 Stack Overflow Developer Survey Results Are Inrender() must be compatible with MagentoBackendBlockWidgetGridColumnRendererRendererInterface::render(MagentoFrameworkDataObject $row)magento2 add display default value for column on admin gridColumn not found Magento2Magento 2 Add new field to Magento_User admin formMagento2 add new field in bundle item (in option selection)Magento 2 Grid serialization : not getting selected product idMagento 2 : Add values to ui_component fieldsColumn not found: 1054 Unknown column 'at_status_default.value'Column not found: 1054 Unknown column 'billing_telephone'how to add Custom column with link in sales order grid magento

Why can Shazam fly?

Aging parents with no investments

Where to refill my bottle in India?

Can a rogue use sneak attack with weapons that have the thrown property even if they are not thrown?

Reference request: Oldest number theory books with (unsolved) exercises?

How to support a colleague who finds meetings extremely tiring?

Is this app Icon Browser Safe/Legit?

Did Section 31 appear in Star Trek: The Next Generation?

Feature engineering suggestion required

Are spiders unable to hurt humans, especially very small spiders?

What to do when moving next to a bird sanctuary with a loosely-domesticated cat?

Deal with toxic manager when you can't quit

One word riddle: Vowel in the middle

Why hard-Brexiteers don't insist on a hard border to prevent illegal immigration after Brexit?

Have you ever entered Singapore using a different passport or name?

The difference between dialogue marks

Origin of "cooter" meaning "vagina"

What is the meaning of the verb "bear" in this context?

Why do we hear so much about the Trump administration deciding to impose and then remove tariffs?

"as much details as you can remember"

Can we generate random numbers using irrational numbers like π and e?

Are there any other methods to apply to solving simultaneous equations?

How to save as into a customized destination on macOS?

Can a flute soloist sit?



How to add a link in a grid column if the records are not found



The 2019 Stack Overflow Developer Survey Results Are Inrender() must be compatible with MagentoBackendBlockWidgetGridColumnRendererRendererInterface::render(MagentoFrameworkDataObject $row)magento2 add display default value for column on admin gridColumn not found Magento2Magento 2 Add new field to Magento_User admin formMagento2 add new field in bundle item (in option selection)Magento 2 Grid serialization : not getting selected product idMagento 2 : Add values to ui_component fieldsColumn not found: 1054 Unknown column 'at_status_default.value'Column not found: 1054 Unknown column 'billing_telephone'how to add Custom column with link in sales order grid magento



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








3















I created a custom module.In grid if data is available then in action column edit option is there. If there is no data, then no edit option is displayed. So, I cannot enter into edit page if no data is available.

I cant use add new entry button. My requirement is to get the link in a grid column. I tried using a renderer but no luck.



namespace VendorModuleBlockAdminhtmlDataGridRenderer;
class Link extends MagentoBackendBlockWidgetGridColumnRendererAbstractRenderer

public function render(MagentoFrameworkDataObject $row)

$category = $row->getDataAllowed();
if (empty($category))

$value = $row->getData($this->getColumn()->getIndex());
return '<a href="http://www.google.com">New'.$value.'</a>';





and in customgrid.php I mention renderer also.



 $this->addColumn('action', array(
'header' => __('Action'),
'width' => '100',
'type' => 'action',
'getter' => 'getId',
'renderer' => 'VendorModuleBlockAdminhtmlDataGridRendererLink',
'actions' => array(
array(
'caption' => __('Edit'),
'url' => array('base' => 'vendor_module/Data/edit'),
'field' => 'id'
)
),
'filter' => false,
'sortable' => false,
'index' => 'stores',
'is_system' => true,
));


The output should come like this
enter image description here










share|improve this question
















bumped to the homepage by Community yesterday


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.















  • using Ui components ? Or BlocK ?

    – Tushar
    Sep 6 '18 at 17:16

















3















I created a custom module.In grid if data is available then in action column edit option is there. If there is no data, then no edit option is displayed. So, I cannot enter into edit page if no data is available.

I cant use add new entry button. My requirement is to get the link in a grid column. I tried using a renderer but no luck.



namespace VendorModuleBlockAdminhtmlDataGridRenderer;
class Link extends MagentoBackendBlockWidgetGridColumnRendererAbstractRenderer

public function render(MagentoFrameworkDataObject $row)

$category = $row->getDataAllowed();
if (empty($category))

$value = $row->getData($this->getColumn()->getIndex());
return '<a href="http://www.google.com">New'.$value.'</a>';





and in customgrid.php I mention renderer also.



 $this->addColumn('action', array(
'header' => __('Action'),
'width' => '100',
'type' => 'action',
'getter' => 'getId',
'renderer' => 'VendorModuleBlockAdminhtmlDataGridRendererLink',
'actions' => array(
array(
'caption' => __('Edit'),
'url' => array('base' => 'vendor_module/Data/edit'),
'field' => 'id'
)
),
'filter' => false,
'sortable' => false,
'index' => 'stores',
'is_system' => true,
));


The output should come like this
enter image description here










share|improve this question
















bumped to the homepage by Community yesterday


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.















  • using Ui components ? Or BlocK ?

    – Tushar
    Sep 6 '18 at 17:16













3












3








3








I created a custom module.In grid if data is available then in action column edit option is there. If there is no data, then no edit option is displayed. So, I cannot enter into edit page if no data is available.

I cant use add new entry button. My requirement is to get the link in a grid column. I tried using a renderer but no luck.



namespace VendorModuleBlockAdminhtmlDataGridRenderer;
class Link extends MagentoBackendBlockWidgetGridColumnRendererAbstractRenderer

public function render(MagentoFrameworkDataObject $row)

$category = $row->getDataAllowed();
if (empty($category))

$value = $row->getData($this->getColumn()->getIndex());
return '<a href="http://www.google.com">New'.$value.'</a>';





and in customgrid.php I mention renderer also.



 $this->addColumn('action', array(
'header' => __('Action'),
'width' => '100',
'type' => 'action',
'getter' => 'getId',
'renderer' => 'VendorModuleBlockAdminhtmlDataGridRendererLink',
'actions' => array(
array(
'caption' => __('Edit'),
'url' => array('base' => 'vendor_module/Data/edit'),
'field' => 'id'
)
),
'filter' => false,
'sortable' => false,
'index' => 'stores',
'is_system' => true,
));


The output should come like this
enter image description here










share|improve this question
















I created a custom module.In grid if data is available then in action column edit option is there. If there is no data, then no edit option is displayed. So, I cannot enter into edit page if no data is available.

I cant use add new entry button. My requirement is to get the link in a grid column. I tried using a renderer but no luck.



namespace VendorModuleBlockAdminhtmlDataGridRenderer;
class Link extends MagentoBackendBlockWidgetGridColumnRendererAbstractRenderer

public function render(MagentoFrameworkDataObject $row)

$category = $row->getDataAllowed();
if (empty($category))

$value = $row->getData($this->getColumn()->getIndex());
return '<a href="http://www.google.com">New'.$value.'</a>';





and in customgrid.php I mention renderer also.



 $this->addColumn('action', array(
'header' => __('Action'),
'width' => '100',
'type' => 'action',
'getter' => 'getId',
'renderer' => 'VendorModuleBlockAdminhtmlDataGridRendererLink',
'actions' => array(
array(
'caption' => __('Edit'),
'url' => array('base' => 'vendor_module/Data/edit'),
'field' => 'id'
)
),
'filter' => false,
'sortable' => false,
'index' => 'stores',
'is_system' => true,
));


The output should come like this
enter image description here







magento2 magento-2.0 magento-2.0.7






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 22 '16 at 5:32







Rising

















asked Nov 21 '16 at 12:55









RisingRising

313




313





bumped to the homepage by Community yesterday


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







bumped to the homepage by Community yesterday


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.














  • using Ui components ? Or BlocK ?

    – Tushar
    Sep 6 '18 at 17:16

















  • using Ui components ? Or BlocK ?

    – Tushar
    Sep 6 '18 at 17:16
















using Ui components ? Or BlocK ?

– Tushar
Sep 6 '18 at 17:16





using Ui components ? Or BlocK ?

– Tushar
Sep 6 '18 at 17:16










1 Answer
1






active

oldest

votes


















0














In your Grid class add this method:



public function getEmptyText()

$url = $this->getUrl('module/controller/new')
return '<a href="'.$url.'">'.__('New record').'</a>';



replace module and controller with the real values from your module.






share|improve this answer























  • Thanks Marius but still I am not getting proper output. I edited my question by adding the image. Please help me thanks in advance.

    – Rising
    Nov 22 '16 at 5:33











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
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f146754%2fhow-to-add-a-link-in-a-grid-column-if-the-records-are-not-found%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









0














In your Grid class add this method:



public function getEmptyText()

$url = $this->getUrl('module/controller/new')
return '<a href="'.$url.'">'.__('New record').'</a>';



replace module and controller with the real values from your module.






share|improve this answer























  • Thanks Marius but still I am not getting proper output. I edited my question by adding the image. Please help me thanks in advance.

    – Rising
    Nov 22 '16 at 5:33















0














In your Grid class add this method:



public function getEmptyText()

$url = $this->getUrl('module/controller/new')
return '<a href="'.$url.'">'.__('New record').'</a>';



replace module and controller with the real values from your module.






share|improve this answer























  • Thanks Marius but still I am not getting proper output. I edited my question by adding the image. Please help me thanks in advance.

    – Rising
    Nov 22 '16 at 5:33













0












0








0







In your Grid class add this method:



public function getEmptyText()

$url = $this->getUrl('module/controller/new')
return '<a href="'.$url.'">'.__('New record').'</a>';



replace module and controller with the real values from your module.






share|improve this answer













In your Grid class add this method:



public function getEmptyText()

$url = $this->getUrl('module/controller/new')
return '<a href="'.$url.'">'.__('New record').'</a>';



replace module and controller with the real values from your module.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 21 '16 at 13:40









MariusMarius

168k28323689




168k28323689












  • Thanks Marius but still I am not getting proper output. I edited my question by adding the image. Please help me thanks in advance.

    – Rising
    Nov 22 '16 at 5:33

















  • Thanks Marius but still I am not getting proper output. I edited my question by adding the image. Please help me thanks in advance.

    – Rising
    Nov 22 '16 at 5:33
















Thanks Marius but still I am not getting proper output. I edited my question by adding the image. Please help me thanks in advance.

– Rising
Nov 22 '16 at 5:33





Thanks Marius but still I am not getting proper output. I edited my question by adding the image. Please help me thanks in advance.

– Rising
Nov 22 '16 at 5:33

















draft saved

draft discarded
















































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.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f146754%2fhow-to-add-a-link-in-a-grid-column-if-the-records-are-not-found%23new-answer', 'question_page');

);

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







Popular posts from this blog

Get product attribute by attribute group code in magento 2get product attribute by product attribute group in magento 2Magento 2 Log Bundle Product Data in List Page?How to get all product attribute of a attribute group of Default attribute set?Magento 2.1 Create a filter in the product grid by new attributeMagento 2 : Get Product Attribute values By GroupMagento 2 How to get all existing values for one attributeMagento 2 get custom attribute of a single product inside a pluginMagento 2.3 How to get all the Multi Source Inventory (MSI) locations collection in custom module?Magento2: how to develop rest API to get new productsGet product attribute by attribute group code ( [attribute_group_code] ) in magento 2

Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

Magento 2.3: How do i solve this, Not registered handle, on custom form?How can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsMagento 2.3 : File Upload issue in UI Component FormMagento2 Not registered handleHow to configured Form Builder Js in my custom magento 2.3.0 module?Magento 2.3. How to create image upload field in an admin form