// Concatenation / Join of two string using Smarty using '|cat:' keyword.
{$param_key = "param_"|cat:$item_name.id}
{$param_key = "param_"|cat:$item_name.id}
/** Auto closing of In/Out POPUP on Select */
var enableInOutDatePicker = function (date1, date2) {
// $( "#start_date" ).datepicker( { startDate:null, format:'dd/mm/yyyy', todayHighlight:true } );
if ( (date1 =="" ) || (date1 == undefined) ) { var date1 = 'start_date'; }
if ( (date2 =="" ) || (date2 == undefined) ) { var date1 = 'end_date'; }
var nowTemp = new Date();
var now = new Date(nowTemp.getFullYear(), nowTemp.getMonth(), nowTemp.getDate(), 0, 0, 0, 0);
//alert(nowTemp);
var checkin = $('#' + date1).datepicker({
beforeShowDay: function (date) {
return date.valueOf() >= now.valueOf();
}
}).on('changeDate', function (ev) {
if (ev.date.valueOf() > checkout.date.valueOf()) {
var newDate = new Date(ev.date);
newDate.setDate(newDate.getDate() + 7);
//alert(newDate);
checkout.setValue(newDate);
//checkout.setDate(newDate);
checkout.update();
}
checkin.hide();
$('#' + date2).focus();
}).data('datepicker');
var checkout = $('#' + date2).datepicker({
beforeShowDay: function (date) {
return date.valueOf() > checkin.date.valueOf();
}
}).on('changeDate', function (ev) {
checkout.hide();
}).data('datepicker');
};
/** Auto closing of In/Out POPUP on Select */
/** Auto closing of POPUP on single date Selection */
var enableSingleDatePicker = function (date) {
if ( (date =="" ) || (date == undefined) ) { var date = 'start_date'; }
var nowTemp = new Date();
var now = new Date(nowTemp.getFullYear(), nowTemp.getMonth(), nowTemp.getDate(), 0, 0, 0, 0);
var checkout = $('#' + date).datepicker({
beforeShowDay: function (date) {
return date.valueOf() >= now.valueOf();
}
}).on('changeDate', function (ev) {
checkout.hide();
}).data('datepicker');
};
/** Reload the Page via AJAX using Jquery. */
(function () {
$('#dvLoading').fadeOut(10); // To Switch Off the loader..
location.reload();
} ());
/** To serialise the Input Form field by ID using Jquery. */
var formData = new FormData(document.getElementById("fieldId"));
alert(formData);
/** Auto Scroll to Top. */
var autoScrollToTop = function (value) {
//var scrollTopVal = 90;
if (typeof value == 'undefined') {
var scrollTopVal = 90;
}
else if ((value != "") && isNaN(value)) {
scrollTopVal = $(value).offset().top;
}
else if (value > 0 ) {
scrollTopVal = value;
}
//alert(scrollTopVal);
$('html, body').animate({ scrollTop: scrollTopVal }, 500); // 500 (mili second) or 'slow'
};
// The function can be called as below;
autoScrollToTop() // Type: Blank, (Default:90)-> Scroll to 90px from top.
autoScrollToTop(0) // Type: Zero -> Top scroll to very top
autoScrollToTop(150) // Type: Numeric -> Scroll to Provided Numeric value(150px) from top.
autoScrollToTop('.className'); // Type: 'className' -> Auto calculate the distance from top to that className component
autoScrollToTop('#elementID'); // Type: 'elementID' -> Auto calculate the distance from top to that elementIDcomponent
// Locate the uri_segment to locate the current page value. $pagination['uri_segment'] = 3;Also, if you are wondering how to find the uri_segment value, then use below code to print all uri_segments array
$segments = $this->uri->segment_array(); print_r($segments);Please find the sample pagination code as below;
$pagination = array();
$pagination['start'] = $start+1;
$pagination['limit'] = $limit;
$pagination['per_page'] = $limit;
$pagination['ipage'] = $ipage;
$pagination['total_rows'] = $this->m_yourmodel->function_result_count($where=array()); // only pull the approved ones.
$pagination['anchor_class'] = 'class="loadAjaxPage" '; // This class is added to make a AJAX Call if you want to load the pages via AJAX
$pagination['offset'] = ($start+$limit); // This is just for the View;
$pagination['uri_segment'] = 3; // Locate the uri_segment to locate the current page value.
$this->load->library('pagination');
$this->pagination->initialize($pagination);
a$pagination['page_links'] = $this->pagination->create_links();
// This class is added to make a AJAX Call if you want to load the pages via $pagination['anchor_class'] = 'class="loadAjaxPage" ';