0% found this document useful (0 votes)
5 views2 pages

Create A New Object 'Class.

The document outlines the creation of a 'Class' object with a 'Student' lookup field pointing to the 'Contact' object, along with three records for 'class 1', 'class 2', and 'class 3'. It explains various coding keywords and directives used in Lightning Web Components (LWC), including 'for:each', 'lightning-combobox', and lifecycle hooks like 'connectedCallback()'. Additionally, it describes the function 'shiftContact()' and its role in managing contact data within the application.

Uploaded by

khizamusmania
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views2 pages

Create A New Object 'Class.

The document outlines the creation of a 'Class' object with a 'Student' lookup field pointing to the 'Contact' object, along with three records for 'class 1', 'class 2', and 'class 3'. It explains various coding keywords and directives used in Lightning Web Components (LWC), including 'for:each', 'lightning-combobox', and lifecycle hooks like 'connectedCallback()'. Additionally, it describes the function 'shiftContact()' and its role in managing contact data within the application.

Uploaded by

khizamusmania
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

create a new object 'Class".

create a field namely "Student" of type Lookup. Lookup will point to "Contact"
object

Provide necessary data like "class 1', "class 2" & "class 3" => 3 records

explain below keyword/coding:

1. for:each={totalStudents}

=>"for:each" directive=>use for working on every item in an array.


=>"totalStudents" is an array wich included by all students data.
=>for:each={totalStudents} means:"Create an HTML element for each student in the
totalStudents list."

2. for:item="student":=> means :that each item from the totalStudents array will be
referred to as student.

3. key={student.Id}: Given every element a unique key(identifier),its helps the LWC


framework efficiently update and manage the DOM (Document Object Model). When
something changes in the list, the key allows the framework to quickly figure out
which element changed, without re-rendering the entire list.

4. {student.Name}
=>{} use for one-way(JavaScript → HTML) binding data binding.(‫میں خودکار طریقے سے دکھانا‬html
‫ میں موجود ڈیٹا کو‬js)
=>student is a js object.
=>.Name is the property of this object.
work of {student.Name}: in your JavaScript file you have a student’s name defined
like this: student = { Name: 'Hizam'};
Now, if you write this in the HTML file:<p>{student.Name}</p>
Then {student.Name} means:Display the "Name" property from the "student" object
right here.
Result:In the browser, it will show:<p>Hizam</p>

5. lightning-combobox
it is a drop-down list component . It allows the user to select a single value from
a list of options.

6. options={statusOptions}(‫ وہ سلکٹڈ سٹیٹس میں محفوظ ہو جائے گا ۔‬،‫)جو بھی انتخاب کرے گا‬

7. onchange={handleStatusChange}
this function run on any change in dropdowen etc.
‫وہ فنکشن ہے جو یہ تبدیلی سنبھالتا ہے اور نئی ویلیو کو محفوظ کرتا ہے۔‬handleStatusChange

8. value={statusOptions.value} binding a value from a JavaScript object to a


component property ,usually an input or a dropdown.

9. connectedCallback() note: everything inside this function


=>(Lifecycle Hook) ‫ یا ختم ہونے والا ہو۔ ایسے‬،‫ رینڈر ہو چکا ہو‬،‫جہاں آپ کچھ خاص کوڈ چلا سکیں — جیسے کمپوننٹ لوڈ ہو رہا ہو‬
‫مواقع فراہم کیے جائیں‬
=>its run when component include in html tree.
Uses:=>loading data from apex class.=>setting the first time data of a variable.=>
applying event lister or timer.=> showing debug information.
shiftContact({}):=>is a function call in which you’re passing an empty object {} as
an argument.
=>Its purpose is usually to perform some operation related to contacts or data,
such as:

.Shifting a contact from one list to another

.Submitting contact data to a server

.Updating or retrieving contact information

.then(result =>:‫یہ حصہ تب چلتا ہے جب کام کامیاب ہو جائے۔‬


‫فرض کریں آپ نے آن لائن کھانا آرڈر کیا‬:

shiftContact() = ‫آرڈر دینا‬

.then(result => {...}) = ‫ تو آپ کھانا کھاتے ہیں یا میز پر رکھتے ہیں‬،‫جب کھانا آ جائے‬

this.totalStudents = result;"Storing the value of result into the property named


totalStudents."

10. handleStatusChange

11.shiftContact() in apex class namely "Attendance"

You might also like