Thursday, June 30, 2016

How to load Jquery or other scrips by console or lazy loading in page

Hi So the other day I was updating a few checkbox manually and then thought then why not do it by Jquery, as soon as I ran the famous selector and prop function chrome throw me error of undefined.
It was due to no jquery loaded in the context or DOM.
To do this there is a simple trick just open the console and paste the below script.


This can also be loaded in page after some execution or even inside "$( document ).ready() {}".

Friday, June 10, 2016

How to "break" pass by reference in Lightning attributes

Hi,
I resently came by the problem in Lightning Aura development. I was developing a page to show some components on the page, the requirment was that user can deselect some of the rows and then data has to be rearranged accordingly simple right!.

I also thought so the approch I took was to have two list one for the values to display and another to hold the cloned values, so if the user rests all I can replace it with clone values and done. What happen in auro if the two variable are seprate but you filled them using a single source of reference then they are pointing to the same memory and hence if one changes other implecitly chnages. To eleminate this proble I simply used "JSON.stringify".

What this will do is when you have your values from controller to JS component then convert it into a well formated structure and then using "eval" convert it back to object. This will break the pass by  reference problem and two values can be independent.