Page 2 of 3

checkbox group and checkbox item behaviour

Posted: Tue May 14, 2013 11:07 am
by w

Found 1 answer: You have to select a single checkbox like this: Tiggzi("chkItem").find("input[type='checkbox']")

So this is solved. But 1 issue that remains, is the fact that the value change event is called 2 times. This gives problems when using a counter, or a .toggle() in the value change event.


checkbox group and checkbox item behaviour

Posted: Tue May 14, 2013 11:52 am
by Kateryna Grynko

Hi,

Let's start by order.

  1. It's our bug, we'll fix it.

    2, 3. In JQM logic, checkbox is an invisible HTML component and its appearance: a tick and a Label. That's why the following line:
    codeAppery('chkItem');/codedoesn't return component but span component that is created by JQM library for setting custom appearance.

    Component span does not have "checked" property. So the following line:
    codeAppery('chkItem').prop('checked')/codealways returns "undefined".

    You should use:codeAppery('chkItem').find('input').prop('checked')/codeorcodeAppery('chkItem').find('input').is(':checked')/code/span/span


checkbox group and checkbox item behaviour

Posted: Tue May 14, 2013 1:10 pm
by w

Thank you Katya! You saved my afternoon work :)


checkbox group and checkbox item behaviour

Posted: Tue May 14, 2013 1:12 pm
by Kateryna Grynko

Glad I can help :)


checkbox group and checkbox item behaviour

Posted: Fri Aug 23, 2013 7:29 am
by Avinash Lt

need an array of items with true or false to determine if the item is checked or not


checkbox group and checkbox item behaviour

Posted: Fri Aug 23, 2013 12:31 pm
by Kateryna Grynko

Hi,

Use the following:
codevar checked_values = $.map( Appery( "mobilecheckboxgroup_17" ).find( ":checked" ), function(e){ return $(e).val(); } );/code


checkbox group and checkbox item behaviour

Posted: Tue Sep 17, 2013 4:47 pm
by osiris1@yahoo.com

given this code below to read the collection of elements in a checkbox group, how would I set it from localStorage?

//Reading
var DOW1 = $.map( Appery( "Alarm1DOW" ).find( ":checked" ), function(e){ return $(e).val(); } );

localStorage.setItem("DOW1", DOW1);

//Writing
var DOW1 = localStorage.getItem("DOW1", DOW1);
$.map( Appery( "Alarm1DOW" ).find( ":checked" ), function(e){ return $(e).val(DOW1); } );


checkbox group and checkbox item behaviour

Posted: Tue Sep 17, 2013 5:53 pm
by Maryna Brodina

checkbox group and checkbox item behaviour

Posted: Tue Sep 17, 2013 6:54 pm
by osiris1@yahoo.com

I adapted my code from the select to the checkbox, but it doesn't seem to fire:

function SetDow()
{
//DOW
var DOW1 = localStorage.getItem("DOW1");

//Now set DOW1
var selectedValues;
try {
selectedValues = JSON.parse(DOW1);
if ({}.toString.call(selectedValues) !== "[object Array]")
{
selectedValues = [];
}
} catch ( e )
{
selectedValues = [];
}

Appery("Alarm1DOW").find(":checked").each(function()
{
var $this = $(this)
if (selectedValues.indexOf($this.prop("value")) != -1)
{
$this.prop("checked", true);
}
else
{
$this.prop("checked", false);
}
})
Appery("Alarm1DOW").selectmenu("refresh");

}


checkbox group and checkbox item behaviour

Posted: Tue Sep 17, 2013 8:15 pm
by Maryna Brodina

Sorry, here is the correct link https://getsatisfaction.com/apperyio/...