EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: garnold on October 20, 2016, 11:53:54 AM



Title: Mobile - Check page before moving to another
Post by: garnold on October 20, 2016, 11:53:54 AM
I have a button that has onclick="$.mobile.go('#p3')" setup. I would like the have a datalist checked for a selection before the page is changed. How is this done please? Thank you.


Title: Re: Mobile - Check page before moving to another
Post by: stworthy on October 20, 2016, 08:14:41 PM
Call 'getChecked' method to detect if some rows are checked.
Code:
var checkedRows = $('#dl').datalist('getChecked');
if (checkedRows.length){
  $.mobile.go('#p3');
}


Title: Re: Mobile - Check page before moving to another
Post by: garnold on October 21, 2016, 06:05:32 AM
Call 'getChecked' method to detect if some rows are checked.
Code:
var checkedRows = $('#dl').datalist('getChecked');
if (checkedRows.length){
  $.mobile.go('#p3');
}

So is it best to just create small sub functions and assign them to these buttons?


Title: Re: Mobile - Check page before moving to another
Post by: garnold on October 21, 2016, 06:29:27 AM
Call 'getChecked' method to detect if some rows are checked.
Code:
var checkedRows = $('#dl').datalist('getChecked');
if (checkedRows.length){
  $.mobile.go('#p3');
}

Actually this ended up working quite well. Thank you for the help ;-)

$('#menuBtnSendWrap').bind('click', function(){
        var checkedRows = $('#dlWraps').datalist('getChecked');
      if (checkedRows.length){
        $.mobile.go('#p3');
      }else{
         $('#dlgAlertMsg').html("Choose a wrap!");
         $('#dlgAlert').dialog('open').dialog('center');
      }
    });