ini Tips dan trick yg ke #5
Tips dan Trick kali ini membahas tentang :
1. AutoPostBack
2. VisualForce Date
3. DaysOfWeek
4. Paging pada repeater
5. Penamaan CSS dan Short-Circuit Evaluation
1. Edwin
Topic : Autopostback. Button default-nya -> autopostback = true (tidak perlu di set lagi).
Set autopostback = true untuk control - control yang default-nya false seperti radio button,
check box, dropdownlist agar bisa postback.
2. Ahui
Topic : Visualforce Date
{!NOW()} dan {!TODAY()} menghasilkan format tanggal yang berbeda.
{!NOW()} -> Tue Sep 16 04:23:47 GMT 2008 -> jam di set
{!TODAY()} -> Tue Sep 16 00:00:00 GMT 2008 -> jam tidak di set
3. Guna
Topic : DaysOfWeek
Digunakan untuk mendapatkan nama hari.
contoh :
Dim weekend As Date
If (Not (weekend.DayOfWeek = DayOfWeek.Saturday) And Not (weekend.DayOfWeek = DayOfWeek.Sunday))
.......
4. Randy
Topic : Paging di Repeater
Menggunakan PagedDataSource dan DataView untuk menghasilkan paging di Repeater.
Contoh :
Dim pgitems As New PagedDataSource
Dim dv As New DataView([data table])
pgitems.DataSource = dv
dv.Sort = "createdDate desc"
pgitems.AllowPaging = True
pgitems.PageSize = 10
.............
5. Ko Johan
Topic :
I. css
penamaan nama css -> case-Sensitive
II. Short-circuit evaluation
Berguna untuk mempercepat proses AND, OR
OR -> versi short circuit = ORELSE
AND -> versi short circuit = ANDALSO
Contoh :
--> A AND B, A OR B -> A & B diproses
--> A ANDALSO B -> B tidak diproses jika A = FALSE
--> A ORELSE B -> B tidak diproses jika A = TRUE