SOW : Core Plugins

SOW = Step Of Web (Smarty author).
SOW plugins are part of Smarty Core, written from scratch!

SOW : Check Group

Checkall plugin, mostly used on tables/lists.


/* 
	:: Plugin File
	src/js/sow.core/sow.checkgroup.js

	:: Plugin Init
*/	$.SOW.core.checkgroup.init('div.checkgroup');

									

Ajax : Single Checkbox

* Open console to see ajax request

<!--
Remove data-checkgroup-ajax-* for non-ajax

Unique checkbox selected:
	data-checkgroup-checkbox-unique="true|false" 
-->
<div class="checkgroup"
		data-checkgroup-checkbox-unique="true" 
		data-checkgroup-ajax-url="../demo.files/php/demo.ajax_request.php" 
		data-checkgroup-ajax-method="GET" 
		data-checkgroup-ajax-params="['param1','value1']['param2','value2']" 
		data-checkgroup-ajax-toast-success="Changes Saved!" 
		data-checkgroup-ajax-toast-position="top-center">

	<label class="form-checkbox form-checkbox-primary d-block">
		<input type="checkbox" name="lorem" value="1" checked="">
		<i></i> Item 1
	</label>

	<!-- 
		example of optional extra `data-params` attribute if needed 
		for each item to be passed to the backend
	-->
	<label class="form-checkbox form-checkbox-primary d-block" data-params="['optionalParam1','optionalValue1']['optionalParam2','optionalValue2']">
		<input type="checkbox" name="lorem" value="2">
		<i></i> Item 2 (with extra params)
	</label>

	<label class="form-checkbox form-checkbox-primary d-block">
		<input type="checkbox" name="lorem" value="3">
		<i></i> Item 3
	</label>

</div>
											

Ajax : Radio

* Open console to see ajax request


<div class="checkgroup"
		data-checkgroup-ajax-url="../demo.files/php/demo.ajax_request.php" 
		data-checkgroup-ajax-method="GET" 
		data-checkgroup-ajax-params="['param1','value1']['param2','value2']" 
		data-checkgroup-ajax-toast-success="Changes Saved!" 
		data-checkgroup-ajax-toast-position="top-center">

	<label class="form-radio form-radio-primary d-block">
		<input type="radio" name="lorem" value="1" checked="">
		<i></i> Item 1
	</label>

	<label class="form-radio form-radio-primary d-block">
		<input type="radio" name="lorem" value="2">
		<i></i> Item 2
	</label>

	<!-- 
		example of optional extra `data-params` attribute if needed 
		for each item to be passed to the backend
	-->
	<label class="form-radio form-radio-primary d-block" data-params="['optionalParam1','optionalValue1']['optionalParam2','optionalValue2']">
		<input type="radio" name="lorem" value="3">
		<i></i> Item 3 (with extra params)
	</label>

</div>