Demos
DEMO 2
This demo shows how to- configure the cell editors and enable the command buttons for editing
- configure the server-side actions for insert, update and delete operations
- plug a custom date picker component and use the editor's delegates
- use custom cell data validators
- use server activity callbacks to display a loader
- implement a custom row tooltip by using the row selection callback events
- customise the script's messages
This demo and demo 1 use the same SQL table, but here records flagged as deleted are also displayed.
Please note that is a live demo and your tests will be recorded in a database!
Instructions: double-click on a cell to open the row editor.
Id | Name | Start Date | Salary | Deleted | Actions | |
---|---|---|---|---|---|---|
52964 | the highest Date is in 2019... | employee@email.com | 2019-12-01 | 0.00 | ||
52963 | hjktfygtuiyg | employee@email.com | 2011-01-12 | 0.00 | ||
52962 | Employee name... | employee@email.com | 2011-01-01 | 0.00 | ||
52961 | asdfsdaf | employee@email.com | 2011-01-01 | 10.10 | ||
52960 | dokter dark | dokter_dark@email.com | 2011-01-01 | 0.00 | ||
52959 | ayoubmengad | employee@email.com | 2011-01-01 | 0.00 | ||
52958 | test | test@email.com | 2011-01-01 | 0.00 | ||
52957 | dfddsfg | employee@email.com | 2011-01-01 | 0.00 | ||
52956 | nombre | employee@email.com | 2011-01-01 | 0.00 | ||
52955 | Employee name... | employee@email.com | 2011-01-06 | 0.00 | ||
52954 | Employee name... | employee@email.com | 2011-01-01 | 0.00 | ||
52953 | Employee name... | employee@email.com | 2011-01-01 | 0.00 | ||
52952 | Employee name... | employee@email.com | 2011-01-01 | 0.00 | ||
52951 | Employee name... | employee@email.com | 2011-01-01 | 0.00 | ||
52950 | test | employee@email.com | 2011-04-02 | 0.00 | ||
52949 | ?????? | employee@email.com | 2011-01-01 | 0.00 | ||
52948 | ?????? | testadfa@gmail.com | 2011-01-01 | 20.00 | ||
52947 | test | employee@email.coms | 2011-01-06 | 0.00 | ||
52946 | ??? | employee@email.com | 2011-01-12 | 10.00 | ||
52945 | Employee name... | employee@email.com | 2011-01-01 | 0.00 | ||
52944 | Employee name... | employee@email.com | 2011-01-01 | 0.00 | ||
52943 | Employee name... | employee@email.com | 2011-01-01 | 0.00 | ||
52942 | Jorge | employee@email.com | 2011-01-01 | 0.00 | ||
52941 | Employee name... | employee@email.com | 2011-01-01 | 0.00 | ||
52940 | Employee name... | employee@email.com | 2011-01-01 | 0.00 | ||
52939 | Employee name... | employee@email.com | 2011-01-01 | 0.00 | ||
52938 | erg4g24tgh42t | employee@email.com | 2011-01-01 | 0.00 | ||
52937 | ze name... | employee@email.com | 2011-01-01 | 0.00 | ||
52936 | Employee name... | employee@email.com | 2011-03-12 | 0.00 | ||
52935 | Employee name... | employee@email.com | 2011-01-01 | 0.00 | ||
52934 | Employee name... | employee@email.com | 2011-01-01 | 0.00 | ||
52933 | Employee name... | employee@email.com | 2011-01-01 | 0.00 | ||
52932 | taki sobie koles bonzo | kloes@email.com | 2019-12-31 | 12.05 | ||
52931 | siano na sniadanie dla koziolkadfs | koziolek@email.com | 0000-00-00 | 0.00 | ||
52930 | ssssssss | ?????????@email.com | 2001-01-20 | 0.00 | ||
52929 | Employee name... | employee@email.com | 2011-01-01 | 0.00 | ||
52928 | gfddfg | employee@email.com | 2011-01-14 | 0.00 | ||
52927 | Employee name... | employeeaa@email.com | 1995-01-01 | 0.00 | ||
52926 | Employee name... | employee@email.com | 2011-01-01 | 0.00 | ||
52925 | u9i090909 | employee@email.com | 2005-02-20 | 0.00 | ||
52924 | Employee name... | employee@email.com | 2011-01-01 | 0.00 | ||
52923 | Employee name... | employee@email.com | 2011-01-01 | 0.00 | ||
52922 | tsting | employee@email.com | 2011-01-05 | 0.00 | ||
52921 | Test Me NOW | employee1@email.com | 2011-01-01 | 0.00 | ||
52920 | Employee name...jj | employee@emailerwr.com | 2011-01-01 | 0.00 | ||
52919 | Employee name... | employee@email.com | 2011-01-01 | 0.00 | ||
52918 | Employee name... | employee@email.com | 2011-01-01 | 0.00 | ||
52917 | Employee name... | employee@email.com | 2011-01-01 | 0.00 | ||
52916 | Employee name... | employee@email.com | 2011-01-01 | 0.00 | ||
52915 | Employee name... | employee@email.com | 2011-01-01 | 0.00 | ||
52914 | Employee name... | employee@email.com | 2011-01-01 | 0.00 | ||
52913 | Employee name... | employee@email.com | 2011-01-01 | 0.00 | ||
52912 | Employee name... | employee@email.com | 2011-01-01 | 0.00 | ||
52911 | Employee name... | employee@email.com | 2011-01-01 | 0.00 | ||
52910 | Employee name... | employee@email.com | 2011-01-01 | 0.00 | ||
52909 | Employee name... | employee@email.com | 2011-01-01 | 0.00 | ||
52908 | Employee name... | employee@email.com | 2011-01-01 | 0.00 | ||
52907 | Employee name... | employee@email.com | 2011-01-01 | 0.00 | ||
52906 | Employee name... | employee@email.com | 2011-01-01 | 0.00 | ||
52905 | oöoiöoiöoiöioöoiö | employee@email.com | 2011-01-01 | 0.00 | ||
52904 | Employee name... | employee@email.com | 2011-01-01 | 0.00 | ||
52903 | Employee name... | employee@email.com | 2011-01-01 | 0.00 | ||
52902 | hola | employee@email.com | 2011-01-01 | 0.00 | ||
52901 | rrrrr | employee@email.com | 2011-01-01 | 0.00 | ||
52900 | Employee name... | employee@email.com | 2011-01-01 | 0.00 | ||
52899 | Employee name... | employee@email.com | 2011-01-01 | 0.00 | ||
52898 | Employee name... | employee@email.com | 2011-01-01 | 0.00 | ||
52897 | Employee name... | employee@email.com | 2011-01-01 | 0.00 | ||
52896 | Employee name... | employee@email.com | 2011-01-01 | 0.00 | ||
52895 | i7i7l78l789 | employee@email.com | 2011-01-01 | 0.00 | ||
52894 | Employee name... | employee@email.com | 2011-01-01 | 0.00 | ||
52893 | Employee name... | employee@email.com | 2011-01-01 | 0.00 | ||
52892 | Employee name... | employee@email.com | 2011-01-01 | 0.00 | ||
52891 | Employee name... | employee@email.com | 2011-01-01 | 0.00 | ||
52890 | Employee name... | employee@email.com | 2011-01-01 | 0.00 | ||
52889 | Employee name... | employee@email.com | 2011-01-01 | 0.00 | ||
52888 | employee@email.com | 2011-01-01 | 0.00 | |||
52887 | Employee name... | employee@email.com | 2011-01-01 | 0.00 | ||
52886 | Employee name... | employee@email.com | 2011-01-01 | 0.00 | ||
52885 | Employee name... | employee@email.com | 2011-01-01 | 0.00 | ||
52884 | Employee name... | employee@email.com | 2011-01-01 | 0.00 | ||
52883 | Employee name... | employee@email.com | 2011-01-01 | 0.00 | ||
52882 | Employee name... | employee@email.com | 2011-01-01 | 0.00 | ||
52881 | Employee name... | employee@email.com | 2011-01-01 | 0.00 | ||
52880 | Employee name... | employee@email.com | 2011-01-01 | 0.00 | ||
52879 | Employee name... | employee@email.com | 2011-01-01 | 0.00 | ||
52878 | Employee name... | employee@email.com | 2011-01-01 | 0.00 | ||
52877 | Employee name... | employee@email.com | 2011-01-01 | 0.00 | ||
52876 | Employee name... | employee@email.com | 2011-01-01 | 0.00 | ||
52875 | Employee name... | employee@email.com | 2011-01-01 | 0.00 | ||
52874 | Employee name... | employee@email.com | 2011-01-01 | 0.00 | ||
52873 | Employee name... | employee@email.com | 2011-01-01 | 0.00 | ||
52872 | Employee name... | employee@email.com | 2011-01-01 | 0.00 | ||
52871 | Employee name... | employee@email.com | 2011-01-01 | 0.00 | ||
52870 | Employee name... | employee@email.com | 2011-01-01 | 0.00 | ||
52869 | Employee name... | employee@email.com | 2011-01-01 | 0.00 | ||
52868 | Employee name... | employee@email.com | 2011-01-01 | 0.00 | ||
52867 | Employee name... | employee@email.com | 2011-01-01 | 0.00 | ||
52866 | Employee name... | employee@email.com | 2011-01-01 | 0.00 | ||
52865 | Employee name... | employee@email.com | 2011-01-01 | 0.00 |
//ezEditTable configuration object var demo2Config = { editable: true, scroll_into_view: true, form_submit_interval: 900, auto_save: false, cell_editors:[ { type: 'none' }, { type: 'input', attributes:[['title', 'First name and last name']], allow_empty_value:true }, { type: 'input', attributes:[['title', 'email address']] }, { type: 'custom', target: 'dateEditor' }, { type: 'input', attributes:[['maxLength', 9], ['title', '9 digits max.']], css:'alignRight' }, { type: 'boolean' }, { type: 'command', buttons:{ enable: ['update', 'insert', 'delete', 'submit', 'cancel'], 'update': { title:'Edit row' }, 'insert': { title:'Add row' }, 'delete': { title:'Delete row' }, 'submit': { text:'Save', title:'Save' }, 'cancel': { text:'Close', title:'Close' } } } ], actions:{ 'update': { uri: 'php/employeeUpdate.php', submit_method: 'form', form_method: 'POST', param_names: ['id','name','email','startdate','salary','active'] }, 'insert': { uri: 'php/employeeInsert.php', submit_method: 'form', form_method: 'POST', param_names: ['id','name','email','startdate','salary','active'], default_record: ['', 'Employee name...', 'employee@email.com', '2011-01-01','0', ''] }, 'delete': { uri: 'php/script.deleteEmployee.php', submit_method: 'script', bulk_delete: false, param_names: ['id'] } }, //Server activity callback events on_server_activity_start: function(o, row){ setTimeout(function(){ o.Get('divLoader').style.display = 'block';}, 5); }, on_server_activity_stop: function(o, row){ setTimeout(function(){ o.Get('divLoader').style.display = 'none';}, 5); }, //Data validation delegate, the script does not provide data validation tools validate_modified_value: function(o, colIndex, oldVal, newVal, cell, editor){ if(colIndex==2 && oldVal != newVal){ if(!et_ValidateEmail(newVal)){ alert('Please insert a valid email!'); return false; } else return true; } else if(colIndex == 4 && oldVal != newVal){ if(isNaN(newVal)){ alert('Please insert a number!'); return false; } else return true; } else return true; }, open_custom_editor: function(o, cell, editor){ cell.appendChild(editor); editor.style.display = ''; }, close_custom_editor: function(o, cell, editor){ editor.style.display = 'none'; document.body.appendChild(editor); var d = o.Get('daySlc'), m = o.Get('monthSlc'), y = o.Get('yearSlc'); d.value = ''; m.value = ''; y.value = ''; }, get_custom_editor_value: function(o, editor, colIndex){ var strDate; var d = o.Get('daySlc'), m = o.Get('monthSlc'), y = o.Get('yearSlc'); strDate = y.value+'-'+m.value+'-'+d.value; return strDate; }, set_custom_editor_value: function(o, editor, colIndex, val){ o.config.SetDateEditorValue(o, val, 'YMD'); }, //Custom toolip on row selection on_after_selected_row: function(o, row){ if(!o.customTooltip || !demo2ActionsInfo || !row.getAttribute('id')) return; var recordId = row.getAttribute('id').replace('tr',''); var actionInfo = demo2ActionsInfo[recordId]; //gets the associated actionInfo object var div = o.Get('divActionInfo_'+recordId); if(div){ div.style.display = 'block'; return; } //div already exists if(actionInfo && actionInfo.hasOwnProperty('createDate')){ var locatorURL = 'http://www.infosniper.net/index.php?map_source=1&overview_map=1&lang=1&map_type=1&zoom_level=7&ip_address='; div = o.CreateElm('div', ['id','divActionInfo_'+recordId]); div.style.cssText = 'position:absolute; display:block; background:#FFFF99; border:1px solid #999; color:#000; padding:5px; margin:-70px 0 0 0px;'; div.innerHTML = 'Created on: '+actionInfo.createDate+ ' by: '+actionInfo.originIp+'' + 'Modified on: '+actionInfo.modDate+' by: '+(actionInfo.modIp!='' ? ''+actionInfo.modIp+'' : '')+'' + 'Deleted on: '+actionInfo.delDate+' by: '+(actionInfo.delIp!='' ? ''+actionInfo.delIp+'' : '')+''; row.cells[0].appendChild(div); } }, on_before_deselected_row: function(o, row){ if(!demo2ActionsInfo || !row.getAttribute('id')) return; var recordId = row.getAttribute('id').replace('tr',''); var div = o.Get('divActionInfo_'+recordId); if(div){ div.parentNode.removeChild(div); div = null; } }, //Messages msg_submit_ok: 'Data processed successfully!', msg_confirm_delete_selected_rows: 'Are you sure you want to delete the selected record?', msg_error_occured: 'Error!' , msg_submit_unsuccessful: 'Data could not be saved correctly!', //Custom date editor function, does not belong to ezEditTable script SetDateEditorValue: function(o, val, dateType){ var date = tf_FormatDate(val, dateType); var d = o.Get('daySlc'), m = o.Get('monthSlc'), y = o.Get('yearSlc'); var day = date.getDate(), month = date.getMonth()+1, year = date.getFullYear(); d.value = day.toString().length==1 ? '0'+day.toString() : day; m.value = month.toString().length==1 ? '0'+month.toString() : month; y.value = year; } };
Top of page