Should I use Javascript Classes or Apex Classes in Lightning Web Components? [on hold] Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) 2019 Community Moderator Election ResultsWant to create select option from ApexAssign value of one field to other field of same object of selected list by clicking a button in list view of objectrepeat rendered for certain conditionHow do I transform SOQL result and output to PageBlockTable?FATAL_ERROR|System.QueryException: List has no rows for assignment to SObjectSLDS classes on (new) base Lightning web components don't workLightning Web Component for table rows and cellsIs there a way to load every label data and every SObject description data in Lightning Web Component using only Javascript without any Apex?When do @wire methods run (LWC)?Calling apex imperative method in lightning web component needs two click to show data
Where did Ptolemy compare the Earth to the distance of fixed stars?
Vertical ranges of Column Plots in 12
First paper to introduce the "principal-agent problem"
By what mechanism was the 2017 UK General Election called?
Fit odd number of triplets in a measure?
How to make triangles with rounded sides and corners? (squircle with 3 sides)
Why do C and C++ allow the expression (int) + 4*5;
How do Java 8 default methods hеlp with lambdas?
Problem with display of presentation
My mentor says to set image to Fine instead of RAW — how is this different from JPG?
3D Masyu - A Die
How to ask rejected full-time candidates to apply to teach individual courses?
How can I prevent/balance waiting and turtling as a response to cooldown mechanics
Random body shuffle every night—can we still function?
What are some likely causes to domain member PC losing contact to domain controller?
.bashrc alias for a command with fixed second parameter
2018 MacBook Pro won't let me install macOS High Sierra 10.13 from USB installer
Does the universe have a fixed centre of mass?
Sally's older brother
Adapting the Chinese Remainder Theorem (CRT) for integers to polynomials
Why complex landing gears are used instead of simple, reliable and light weight muscle wire or shape memory alloys?
The Nth Gryphon Number
Did any compiler fully use 80-bit floating point?
malloc in main() or malloc in another function: allocating memory for a struct and its members
Should I use Javascript Classes or Apex Classes in Lightning Web Components? [on hold]
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)
2019 Community Moderator Election ResultsWant to create select option from ApexAssign value of one field to other field of same object of selected list by clicking a button in list view of objectrepeat rendered for certain conditionHow do I transform SOQL result and output to PageBlockTable?FATAL_ERROR|System.QueryException: List has no rows for assignment to SObjectSLDS classes on (new) base Lightning web components don't workLightning Web Component for table rows and cellsIs there a way to load every label data and every SObject description data in Lightning Web Component using only Javascript without any Apex?When do @wire methods run (LWC)?Calling apex imperative method in lightning web component needs two click to show data
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I am working on designing a timesheet Lightning Web Component for my company. Internally, we use a sObject that tracks individual sessions, which then gets rolled up one way to generate payroll, and another way to create invoices. To that end, we don't have a timesheet sObject in our schema (we do have a paystub sObject, but we run payroll every two weeks and collect timesheets every week).
The general flow of what needs to happen is run a SOQL query, transform the data into rows (clients) and columns (dates), and then display the data for viewing and editing. The SOQL clearly happens in an Apex class, and the display is clearly happening in an LWC, but I am unclear about the transformation stage. Would it make sense to have an Apex class gather all the data, transform it, and then @wire the data to the LWC row by row? Or should I just use the Apex class to generate all of the data, @wire a list to the LWC, and use Javascript objects to sort everything into rows and columns?
apex soql lightning-web-components
New contributor
put on hold as primarily opinion-based by Jayant Das, Sebastian Kessel, Reshma, Pranay Jaiswal, Raul Apr 18 at 5:44
Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.
add a comment |
I am working on designing a timesheet Lightning Web Component for my company. Internally, we use a sObject that tracks individual sessions, which then gets rolled up one way to generate payroll, and another way to create invoices. To that end, we don't have a timesheet sObject in our schema (we do have a paystub sObject, but we run payroll every two weeks and collect timesheets every week).
The general flow of what needs to happen is run a SOQL query, transform the data into rows (clients) and columns (dates), and then display the data for viewing and editing. The SOQL clearly happens in an Apex class, and the display is clearly happening in an LWC, but I am unclear about the transformation stage. Would it make sense to have an Apex class gather all the data, transform it, and then @wire the data to the LWC row by row? Or should I just use the Apex class to generate all of the data, @wire a list to the LWC, and use Javascript objects to sort everything into rows and columns?
apex soql lightning-web-components
New contributor
put on hold as primarily opinion-based by Jayant Das, Sebastian Kessel, Reshma, Pranay Jaiswal, Raul Apr 18 at 5:44
Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.
1
If I had to design this, I would have created a wrapper class to collect all data within the Apex and then return theList<MyWrapperClass>
to the LWC. This way I would keep all the logic of fetching/transforming/saving data consolidated at one place.
– Jayant Das
Apr 15 at 18:06
add a comment |
I am working on designing a timesheet Lightning Web Component for my company. Internally, we use a sObject that tracks individual sessions, which then gets rolled up one way to generate payroll, and another way to create invoices. To that end, we don't have a timesheet sObject in our schema (we do have a paystub sObject, but we run payroll every two weeks and collect timesheets every week).
The general flow of what needs to happen is run a SOQL query, transform the data into rows (clients) and columns (dates), and then display the data for viewing and editing. The SOQL clearly happens in an Apex class, and the display is clearly happening in an LWC, but I am unclear about the transformation stage. Would it make sense to have an Apex class gather all the data, transform it, and then @wire the data to the LWC row by row? Or should I just use the Apex class to generate all of the data, @wire a list to the LWC, and use Javascript objects to sort everything into rows and columns?
apex soql lightning-web-components
New contributor
I am working on designing a timesheet Lightning Web Component for my company. Internally, we use a sObject that tracks individual sessions, which then gets rolled up one way to generate payroll, and another way to create invoices. To that end, we don't have a timesheet sObject in our schema (we do have a paystub sObject, but we run payroll every two weeks and collect timesheets every week).
The general flow of what needs to happen is run a SOQL query, transform the data into rows (clients) and columns (dates), and then display the data for viewing and editing. The SOQL clearly happens in an Apex class, and the display is clearly happening in an LWC, but I am unclear about the transformation stage. Would it make sense to have an Apex class gather all the data, transform it, and then @wire the data to the LWC row by row? Or should I just use the Apex class to generate all of the data, @wire a list to the LWC, and use Javascript objects to sort everything into rows and columns?
apex soql lightning-web-components
apex soql lightning-web-components
New contributor
New contributor
New contributor
asked Apr 15 at 18:00
Andrew FavaloroAndrew Favaloro
333
333
New contributor
New contributor
put on hold as primarily opinion-based by Jayant Das, Sebastian Kessel, Reshma, Pranay Jaiswal, Raul Apr 18 at 5:44
Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.
put on hold as primarily opinion-based by Jayant Das, Sebastian Kessel, Reshma, Pranay Jaiswal, Raul Apr 18 at 5:44
Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.
1
If I had to design this, I would have created a wrapper class to collect all data within the Apex and then return theList<MyWrapperClass>
to the LWC. This way I would keep all the logic of fetching/transforming/saving data consolidated at one place.
– Jayant Das
Apr 15 at 18:06
add a comment |
1
If I had to design this, I would have created a wrapper class to collect all data within the Apex and then return theList<MyWrapperClass>
to the LWC. This way I would keep all the logic of fetching/transforming/saving data consolidated at one place.
– Jayant Das
Apr 15 at 18:06
1
1
If I had to design this, I would have created a wrapper class to collect all data within the Apex and then return the
List<MyWrapperClass>
to the LWC. This way I would keep all the logic of fetching/transforming/saving data consolidated at one place.– Jayant Das
Apr 15 at 18:06
If I had to design this, I would have created a wrapper class to collect all data within the Apex and then return the
List<MyWrapperClass>
to the LWC. This way I would keep all the logic of fetching/transforming/saving data consolidated at one place.– Jayant Das
Apr 15 at 18:06
add a comment |
1 Answer
1
active
oldest
votes
Unless the transformation significantly reduces the amount of data you have to send from the server to the client, it most likely makes sense to do as much as possible in the client (JavaScript). JavaScript is far more efficient in CPU time than Apex, so you'll reduce the overall time the user has to wait for the results to appear. Also, if you decide you later want to provide different options (filtering, sorting, etc), you can avoid network activity entirely by using JavaScript as much as possible, allowing near-instant updates to the page.
1
Adding color to this discussion: ES6.map()
,.filter()
and.reduce()
significantly improve UX at the expense of server-side reusability. You can still offload any helpers to a LWC utils file and find client-side reusability there.
– tsalb
Apr 15 at 20:22
I know that the LWC framework is built on top of ES5, how much of ES6 is available/unavailable?
– Andrew Favaloro
Apr 16 at 14:08
@AndrewFavaloro this doc goes in to detail, but essentially, all of ES6 and ES7, most of ES8, and some of ES9.
– sfdcfox
Apr 16 at 14:24
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Unless the transformation significantly reduces the amount of data you have to send from the server to the client, it most likely makes sense to do as much as possible in the client (JavaScript). JavaScript is far more efficient in CPU time than Apex, so you'll reduce the overall time the user has to wait for the results to appear. Also, if you decide you later want to provide different options (filtering, sorting, etc), you can avoid network activity entirely by using JavaScript as much as possible, allowing near-instant updates to the page.
1
Adding color to this discussion: ES6.map()
,.filter()
and.reduce()
significantly improve UX at the expense of server-side reusability. You can still offload any helpers to a LWC utils file and find client-side reusability there.
– tsalb
Apr 15 at 20:22
I know that the LWC framework is built on top of ES5, how much of ES6 is available/unavailable?
– Andrew Favaloro
Apr 16 at 14:08
@AndrewFavaloro this doc goes in to detail, but essentially, all of ES6 and ES7, most of ES8, and some of ES9.
– sfdcfox
Apr 16 at 14:24
add a comment |
Unless the transformation significantly reduces the amount of data you have to send from the server to the client, it most likely makes sense to do as much as possible in the client (JavaScript). JavaScript is far more efficient in CPU time than Apex, so you'll reduce the overall time the user has to wait for the results to appear. Also, if you decide you later want to provide different options (filtering, sorting, etc), you can avoid network activity entirely by using JavaScript as much as possible, allowing near-instant updates to the page.
1
Adding color to this discussion: ES6.map()
,.filter()
and.reduce()
significantly improve UX at the expense of server-side reusability. You can still offload any helpers to a LWC utils file and find client-side reusability there.
– tsalb
Apr 15 at 20:22
I know that the LWC framework is built on top of ES5, how much of ES6 is available/unavailable?
– Andrew Favaloro
Apr 16 at 14:08
@AndrewFavaloro this doc goes in to detail, but essentially, all of ES6 and ES7, most of ES8, and some of ES9.
– sfdcfox
Apr 16 at 14:24
add a comment |
Unless the transformation significantly reduces the amount of data you have to send from the server to the client, it most likely makes sense to do as much as possible in the client (JavaScript). JavaScript is far more efficient in CPU time than Apex, so you'll reduce the overall time the user has to wait for the results to appear. Also, if you decide you later want to provide different options (filtering, sorting, etc), you can avoid network activity entirely by using JavaScript as much as possible, allowing near-instant updates to the page.
Unless the transformation significantly reduces the amount of data you have to send from the server to the client, it most likely makes sense to do as much as possible in the client (JavaScript). JavaScript is far more efficient in CPU time than Apex, so you'll reduce the overall time the user has to wait for the results to appear. Also, if you decide you later want to provide different options (filtering, sorting, etc), you can avoid network activity entirely by using JavaScript as much as possible, allowing near-instant updates to the page.
answered Apr 15 at 18:14
sfdcfoxsfdcfox
266k13212459
266k13212459
1
Adding color to this discussion: ES6.map()
,.filter()
and.reduce()
significantly improve UX at the expense of server-side reusability. You can still offload any helpers to a LWC utils file and find client-side reusability there.
– tsalb
Apr 15 at 20:22
I know that the LWC framework is built on top of ES5, how much of ES6 is available/unavailable?
– Andrew Favaloro
Apr 16 at 14:08
@AndrewFavaloro this doc goes in to detail, but essentially, all of ES6 and ES7, most of ES8, and some of ES9.
– sfdcfox
Apr 16 at 14:24
add a comment |
1
Adding color to this discussion: ES6.map()
,.filter()
and.reduce()
significantly improve UX at the expense of server-side reusability. You can still offload any helpers to a LWC utils file and find client-side reusability there.
– tsalb
Apr 15 at 20:22
I know that the LWC framework is built on top of ES5, how much of ES6 is available/unavailable?
– Andrew Favaloro
Apr 16 at 14:08
@AndrewFavaloro this doc goes in to detail, but essentially, all of ES6 and ES7, most of ES8, and some of ES9.
– sfdcfox
Apr 16 at 14:24
1
1
Adding color to this discussion: ES6
.map()
, .filter()
and .reduce()
significantly improve UX at the expense of server-side reusability. You can still offload any helpers to a LWC utils file and find client-side reusability there.– tsalb
Apr 15 at 20:22
Adding color to this discussion: ES6
.map()
, .filter()
and .reduce()
significantly improve UX at the expense of server-side reusability. You can still offload any helpers to a LWC utils file and find client-side reusability there.– tsalb
Apr 15 at 20:22
I know that the LWC framework is built on top of ES5, how much of ES6 is available/unavailable?
– Andrew Favaloro
Apr 16 at 14:08
I know that the LWC framework is built on top of ES5, how much of ES6 is available/unavailable?
– Andrew Favaloro
Apr 16 at 14:08
@AndrewFavaloro this doc goes in to detail, but essentially, all of ES6 and ES7, most of ES8, and some of ES9.
– sfdcfox
Apr 16 at 14:24
@AndrewFavaloro this doc goes in to detail, but essentially, all of ES6 and ES7, most of ES8, and some of ES9.
– sfdcfox
Apr 16 at 14:24
add a comment |
1
If I had to design this, I would have created a wrapper class to collect all data within the Apex and then return the
List<MyWrapperClass>
to the LWC. This way I would keep all the logic of fetching/transforming/saving data consolidated at one place.– Jayant Das
Apr 15 at 18:06