EasyUI Forum
October 16, 2025, 12:32:39 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
  Home Help Search Login Register  
  Show Posts
Pages: [1]
1  General Category / General Discussion / Re: clear combobox on: May 12, 2015, 06:51:34 AM
hello

I dont know if this may help, but why dont you use the keyup event to detect the delete key on the combobox and call the 'unselect' event acordingly.

Code:
$('#cc').combobox({
inputEvents: $.extend({}, $.fn.combo.defaults.inputEvents, {
keyup:function(e){
  if(e.keyCode == 46){
                    var value = $('#cc').combobox('getText');  // the item value to be selected
                    $('#cc').combobox('unselect', value);
  }

}
})
})

regards
2  General Category / EasyUI for jQuery / Re: event when failed submit a form on: March 04, 2015, 08:51:54 AM
Hello

As far I undestand you want to know if there was no answer from server after submiting a form. If thats the case the onSubmit can validate if there was no answer, an error or success.

1. create a function to submit when click on button.
2. check for the answers of the onSubmit.

Code:
function saveProcess(){
    $('#fm').form('submit',{
        url: 'SaveProcess.php',
        onSubmit: function(){
            return $(this).form('validate');
        },
        success: function(result){ // the url must return an answer
    if (result == '') { // if no answer (submit failed)
                $.messager.show({
                    title: 'Error',
                    msg: 'No answer from server'
                });
     } else if (result.replace(/\W/g,'') !== 'OK'){ //if answer is not OK ("error" you can set your own answer)
                $.messager.show({
                    title: 'Error',
                    msg: result,
width:'650',
height:'800',
style:{
right:'',
bottom:''
}
                });
              } else { //the answer is OK.

              $.messager.show({
                title: 'Success',
                msg: 'Process saved',
style:{
right:'',
bottom:''
}
               });

            }
        }
    });
};


I'm not sure if this is what you're asking, but is a way to validate the submiting of a form.

regards
3  General Category / EasyUI for jQuery / Re: datagrid reload on: March 04, 2015, 07:59:17 AM
hello.

Use the onSave event to execute code after saving a record in edatagrid.

Code:
$('#MyEDatagrid').edatagrid({
  onSave:function(index,row){
    window.top.location.reload(); //reloads the entire page
  }
});

or you coudl just reload the edatagrid

Code:
$('#MyEDatagrid').edatagrid({
  onSave:function(index,row){
    $('#MyEDatagrid').edatagrid('reload');
  }
});


hope that helps
4  General Category / EasyUI for jQuery / Disable holidays and weekends on calendar (datebox) on: March 02, 2015, 05:01:06 AM
hello.

This code uses the validator property of the calendar control of a datebox; to use it only on a calendar just change the line:

Code:
$('#MyDateBox').datebox().datebox('calendar').calendar({

for this:

Code:
$('#MyCalendar').calendar({

To disable especific dates:

Code:
$(function(){
var NoValDates = ["01/01/2015", "12/01/2015", "23/03/2015", "02/04/2015", "03/04/2015", "01/05/2015", "18/05/2015", "08/06/2015", "15/06/2015", "29/06/2015", "20/07/2015", "07/08/2015", "17/08/2015", "12/10/2015", "02/11/2015", "16/11/2015", "08/12/2015", "25/12/2015"];
var x = NoValDates.length;
 $('#MyDateBox').datebox().datebox('calendar').calendar({
   validator: function(date){
    for (j=0;j<x;j++){
     var d = NoValDates[j].slice(0,2);
     var m = NoValDates[j].slice(3,5)-1;
     var y = NoValDates[j].slice(6,10);
       if(date.getDate()==d  && date.getMonth()==m && date.getFullYear()==y){
return false;
       }
    }

    if(date.getDay()==0 || date.getDay()==6){return false;}else{return true;}; //disables weekends
    return true;
   }
  });
});

The date format used in this code is dd/MM/yyyy.

regards.
Pages: [1]
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!