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;








6















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?










share|improve this question







New contributor




Andrew Favaloro is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











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

















6















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?










share|improve this question







New contributor




Andrew Favaloro is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











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













6












6








6








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?










share|improve this question







New contributor




Andrew Favaloro is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












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






share|improve this question







New contributor




Andrew Favaloro is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question







New contributor




Andrew Favaloro is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question






New contributor




Andrew Favaloro is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked Apr 15 at 18:00









Andrew FavaloroAndrew Favaloro

333




333




New contributor




Andrew Favaloro is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Andrew Favaloro is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Andrew Favaloro is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




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












  • 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







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










1 Answer
1






active

oldest

votes


















5














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.






share|improve this answer


















  • 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 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









5














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.






share|improve this answer


















  • 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















5














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.






share|improve this answer


















  • 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













5












5








5







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.






share|improve this answer













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.







share|improve this answer












share|improve this answer



share|improve this answer










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












  • 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



Popular posts from this blog

Wikipedia:Vital articles Мазмуну Biography - Өмүр баян Philosophy and psychology - Философия жана психология Religion - Дин Social sciences - Коомдук илимдер Language and literature - Тил жана адабият Science - Илим Technology - Технология Arts and recreation - Искусство жана эс алуу History and geography - Тарых жана география Навигация менюсу

Bruxelas-Capital Índice Historia | Composición | Situación lingüística | Clima | Cidades irmandadas | Notas | Véxase tamén | Menú de navegacióneO uso das linguas en Bruxelas e a situación do neerlandés"Rexión de Bruxelas Capital"o orixinalSitio da rexiónPáxina de Bruselas no sitio da Oficina de Promoción Turística de Valonia e BruxelasMapa Interactivo da Rexión de Bruxelas-CapitaleeWorldCat332144929079854441105155190212ID28008674080552-90000 0001 0666 3698n94104302ID540940339365017018237

What should I write in an apology letter, since I have decided not to join a company after accepting an offer letterShould I keep looking after accepting a job offer?What should I do when I've been verbally told I would get an offer letter, but still haven't gotten one after 4 weeks?Do I accept an offer from a company that I am not likely to join?New job hasn't confirmed starting date and I want to give current employer as much notice as possibleHow should I address my manager in my resignation letter?HR delayed background verification, now jobless as resignedNo email communication after accepting a formal written offer. How should I phrase the call?What should I do if after receiving a verbal offer letter I am informed that my written job offer is put on hold due to some internal issues?Should I inform the current employer that I am about to resign within 1-2 weeks since I have signed the offer letter and waiting for visa?What company will do, if I send their offer letter to another company