Add column to gridview in custom extension
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
I have a custom extension where the admin user needs to select a customer from the drop down. The extension saves the customer ID to the database.
Currently, on the grid view, in my UI component I have the following:
<column name="customer_id">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="filter" xsi:type="string">textRange</item>
<item name="sorting" xsi:type="string">asc</item>
<item name="label" xsi:type="string" translate="true">Customer ID</item>
</item>
</argument>
</column>
This displays the customer id as expected.
However, my question is how do actually display the customer name instead of just the ID in the grid view?
magento2 grid uicomponent grid-layout
add a comment |
I have a custom extension where the admin user needs to select a customer from the drop down. The extension saves the customer ID to the database.
Currently, on the grid view, in my UI component I have the following:
<column name="customer_id">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="filter" xsi:type="string">textRange</item>
<item name="sorting" xsi:type="string">asc</item>
<item name="label" xsi:type="string" translate="true">Customer ID</item>
</item>
</argument>
</column>
This displays the customer id as expected.
However, my question is how do actually display the customer name instead of just the ID in the grid view?
magento2 grid uicomponent grid-layout
add a comment |
I have a custom extension where the admin user needs to select a customer from the drop down. The extension saves the customer ID to the database.
Currently, on the grid view, in my UI component I have the following:
<column name="customer_id">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="filter" xsi:type="string">textRange</item>
<item name="sorting" xsi:type="string">asc</item>
<item name="label" xsi:type="string" translate="true">Customer ID</item>
</item>
</argument>
</column>
This displays the customer id as expected.
However, my question is how do actually display the customer name instead of just the ID in the grid view?
magento2 grid uicomponent grid-layout
I have a custom extension where the admin user needs to select a customer from the drop down. The extension saves the customer ID to the database.
Currently, on the grid view, in my UI component I have the following:
<column name="customer_id">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="filter" xsi:type="string">textRange</item>
<item name="sorting" xsi:type="string">asc</item>
<item name="label" xsi:type="string" translate="true">Customer ID</item>
</item>
</argument>
</column>
This displays the customer id as expected.
However, my question is how do actually display the customer name instead of just the ID in the grid view?
magento2 grid uicomponent grid-layout
magento2 grid uicomponent grid-layout
asked 2 days ago
Goose84Goose84
1,30911242
1,30911242
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
You have to define your own custom class in order to get and display the firstname and the lastname of the customer in one UI column field, otherwise you can either use only one of them.
Like below code:
<column name="customer_firstname">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="filter" xsi:type="string">textRange</item>
<item name="sorting" xsi:type="string">asc</item>
<item name="label" xsi:type="string" translate="true">Customer Firstname</item>
</item>
</argument>
</column>
How would you define my own custom class and what would be the contents?
– Goose84
2 days ago
You can check like this one : magento.stackexchange.com/questions/178286/…
– magefms
2 days ago
1
The issue with this method though I would have to do logic on each row? I was thinking if I join in the customer_entity table then the extension would be more efficient, wouldn't it?
– Goose84
2 days ago
yeah you are right with that I can agree.
– magefms
2 days ago
add a comment |
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%2f269045%2fadd-column-to-gridview-in-custom-extension%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 have to define your own custom class in order to get and display the firstname and the lastname of the customer in one UI column field, otherwise you can either use only one of them.
Like below code:
<column name="customer_firstname">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="filter" xsi:type="string">textRange</item>
<item name="sorting" xsi:type="string">asc</item>
<item name="label" xsi:type="string" translate="true">Customer Firstname</item>
</item>
</argument>
</column>
How would you define my own custom class and what would be the contents?
– Goose84
2 days ago
You can check like this one : magento.stackexchange.com/questions/178286/…
– magefms
2 days ago
1
The issue with this method though I would have to do logic on each row? I was thinking if I join in the customer_entity table then the extension would be more efficient, wouldn't it?
– Goose84
2 days ago
yeah you are right with that I can agree.
– magefms
2 days ago
add a comment |
You have to define your own custom class in order to get and display the firstname and the lastname of the customer in one UI column field, otherwise you can either use only one of them.
Like below code:
<column name="customer_firstname">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="filter" xsi:type="string">textRange</item>
<item name="sorting" xsi:type="string">asc</item>
<item name="label" xsi:type="string" translate="true">Customer Firstname</item>
</item>
</argument>
</column>
How would you define my own custom class and what would be the contents?
– Goose84
2 days ago
You can check like this one : magento.stackexchange.com/questions/178286/…
– magefms
2 days ago
1
The issue with this method though I would have to do logic on each row? I was thinking if I join in the customer_entity table then the extension would be more efficient, wouldn't it?
– Goose84
2 days ago
yeah you are right with that I can agree.
– magefms
2 days ago
add a comment |
You have to define your own custom class in order to get and display the firstname and the lastname of the customer in one UI column field, otherwise you can either use only one of them.
Like below code:
<column name="customer_firstname">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="filter" xsi:type="string">textRange</item>
<item name="sorting" xsi:type="string">asc</item>
<item name="label" xsi:type="string" translate="true">Customer Firstname</item>
</item>
</argument>
</column>
You have to define your own custom class in order to get and display the firstname and the lastname of the customer in one UI column field, otherwise you can either use only one of them.
Like below code:
<column name="customer_firstname">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="filter" xsi:type="string">textRange</item>
<item name="sorting" xsi:type="string">asc</item>
<item name="label" xsi:type="string" translate="true">Customer Firstname</item>
</item>
</argument>
</column>
answered 2 days ago
magefmsmagefms
2,5862426
2,5862426
How would you define my own custom class and what would be the contents?
– Goose84
2 days ago
You can check like this one : magento.stackexchange.com/questions/178286/…
– magefms
2 days ago
1
The issue with this method though I would have to do logic on each row? I was thinking if I join in the customer_entity table then the extension would be more efficient, wouldn't it?
– Goose84
2 days ago
yeah you are right with that I can agree.
– magefms
2 days ago
add a comment |
How would you define my own custom class and what would be the contents?
– Goose84
2 days ago
You can check like this one : magento.stackexchange.com/questions/178286/…
– magefms
2 days ago
1
The issue with this method though I would have to do logic on each row? I was thinking if I join in the customer_entity table then the extension would be more efficient, wouldn't it?
– Goose84
2 days ago
yeah you are right with that I can agree.
– magefms
2 days ago
How would you define my own custom class and what would be the contents?
– Goose84
2 days ago
How would you define my own custom class and what would be the contents?
– Goose84
2 days ago
You can check like this one : magento.stackexchange.com/questions/178286/…
– magefms
2 days ago
You can check like this one : magento.stackexchange.com/questions/178286/…
– magefms
2 days ago
1
1
The issue with this method though I would have to do logic on each row? I was thinking if I join in the customer_entity table then the extension would be more efficient, wouldn't it?
– Goose84
2 days ago
The issue with this method though I would have to do logic on each row? I was thinking if I join in the customer_entity table then the extension would be more efficient, wouldn't it?
– Goose84
2 days ago
yeah you are right with that I can agree.
– magefms
2 days ago
yeah you are right with that I can agree.
– magefms
2 days ago
add a comment |
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%2f269045%2fadd-column-to-gridview-in-custom-extension%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