Show Posts
|
Pages: [1] 2 3 ... 7
|
5
|
General Category / EasyUI for jQuery / Detect mousedown event on datagrid's scrollbar (SOLVED)
|
on: December 03, 2020, 10:00:42 AM
|
How can I determine if the mouse is clicked on datagrid's vertical/horizontal scrollbar? Please note that the datagrid-scrollbars may not be present always. And if they are present, how can I ignore the mousedown event on it. As seen in the screencast below, a warning is displayed when the user clicks outside the row being edited. But the warning also gets displayed when the click is on datagrid's vertical scrollbar. Screencast: https://streamable.com/5eawxt
|
|
|
6
|
General Category / EasyUI for jQuery / Re: extend validateRow to consider limitToList
|
on: September 18, 2020, 12:43:04 PM
|
Thanks Jarry for your suggestion, will try it out. I was looking for a generic solution without having to adjust dozens of editors. I have in between extended the datagrid methods and overwritten the standard 'validateRow': $.extend($.fn.datagrid.methods, { validateRow: function(jq, index){ return gordisExtendedValidateRow(jq[0], index); } });
$.fn.combobox.defaults = $.extend({}, $.fn.combobox.defaults, { validateSelection: true });
/** * Overwritten validateRow method of easyui to perform additional validation. * Here, the combobox editors are validated to ensure a valid selection from its list is made. */ function gordisExtendedValidateRow(target, index){ const tr = $.data(target, 'datagrid').options.finder.getTr(target, index); if (!tr.hasClass('datagrid-row-editing')){ return true; }
const vbox = tr.find('.validatebox-text'); vbox.validatebox('validate'); vbox.trigger('mouseleave'); const invalidbox = tr.find('.validatebox-invalid'); let result = invalidbox.length === 0; if (result) { // Now check if combobox editors contain valid selection const editors = $(target).edatagrid('getEditors', index); for(let i=0; i<editors.length;i++) { const editor = editors[i]; if (editor.type === 'combobox') { const comboEditor = $(editor.target); if(comboEditor.combobox('options').validateSelection === true && textNotEmpty(comboEditor.combobox('getText')) && _isSelectionValid(editor.target) === false) { comboEditor.combobox('textbox').addClass("validatebox-invalid"); result = false; break; } } } } return result;
function _isSelectionValid(comboboxComp) { const c = $(comboboxComp); const opts = c.combobox('options'); const data = c.combobox('getData'); let exists = false; for(let i=0; i<data.length; i++){ if (c.combobox('getText') === data[i][opts.textField]){ exists = true; break; } } return exists; } }
The extended validation for combobox editors will be skipped if the option validateSelection is set to false.
|
|
|
13
|
General Category / EasyUI for jQuery / Datagrid continue editing row after negative validation check
|
on: May 20, 2019, 09:07:55 AM
|
I have a datagrid with five columns having checkbox editor. If a row is edited, at least ONE of the five checkboxes must be checked. If not, I want to inform the user "please select a checkbox" while remaining in the editing mode. How can this be achieved? Currently, the row editing gets ended and the user has to double click to begin the editing again: onEndEdit: function (index, rowToSave) { if (rowToSave.isNewRecord && atleastOneCheckboxSelected(rowToSave) === false) { showSlideMsg("Please select a checkbox!"); return false; } ... save row ... }
Thanks for the help.
|
|
|
|