Sunday, 15 September 2013

Checkboxlist in Lightswitch HTML client -



Checkboxlist in Lightswitch HTML client -

i'm new lightswitch please bear me if stupid, or obvious question. question lightswitch html client - not desktop client.

i have scenario have article can tagged against 1 or more destinations (countries). ideally, when adding or editing article, there multiple tabs. 1 details (title, standfirst, body etc.) , 1 tagging. i'd implement using checkboxlist.

any ideas on how implement scenario in lightswitch much appreciated.

many thanks

hope helps:

the default command type boolean info type flipswitch control, can substitute checkbox using custom control.

in screen designer, take node boolean field, , alter command type flipswitch custom control. in properties window, in height section, take min , come in 100.this necessary because checkbox command taller standard textbox control. if form uses other command types, may need adjust value. in general section, take edit render code link. in code editor, add together next code render method: javascript

// create checkbox , add together dom. var checkbox = $("<input type='checkbox'/>") .css({ height: 20, width: 20, margin: "10px" }) .appendto($(element)); // determine if alter initiated user. var changingvalue = false; checkbox.change(function () { changingvalue = true; contentitem.value = checkbox[0].checked; changingvalue = false; }); contentitem.databind("value", function (newvalue) { if (!changingvalue) { checkbox[0].checked = newvalue; } });

if you’re displaying checkbox required field on add/edit screen, you’ll want set initial value control, otherwise user may validation error. set initial value, in entity designer, on perspective bar, take htmlclient tab. in write code list, take created. in code editor, set initial values adding code created method: javascript entity.fieldname = new boolean(); entity.fieldname = 'true'; replace fieldname name of boolean field. initialize command unchecked state, replace true false.

visual-studio-lightswitch lightswitch-2013

No comments:

Post a Comment