Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Changes the order_by filter and reloads the datagrid
- *
- * @param string
- * id datagrid id
- * @param string
- * key name of the field to order by
- */
- var datagridv2_readyFunctions = [];
- function datagridv2_registerReadyFunction(id, func) {
- if (empty(datagridv2_readyFunctions[id])) {
- datagridv2_readyFunctions[id] = [];
- }
- datagridv2_readyFunctions[id].push(func);
- }
- function datagridv2_order(id, key) {
- var order = jQuery('#order_by_' + id);
- jQuery('.order_by_' + id + ' .datagrid_order_img').hide();
- jQuery('.order_by_' + id + ' .datagrid_order_none').show();
- if (order.val() == "" || order.val() != key + " ASC") {
- order.val(key + " ASC");
- jQuery('#order_by_' + id + '_' + key + ' .datagrid_order_none').hide();
- jQuery('#order_by_' + id + '_' + key + ' .datagrid_order_asc').show();
- } else {
- order.val(key + " DESC");
- jQuery('#order_by_' + id + '_' + key + ' .datagrid_order_none').hide();
- jQuery('#order_by_' + id + '_' + key + ' .datagrid_order_desc').show();
- }
- datagridv2_reload(id);
- }
- function datagridv2_pagin(id, page, nb) {
- var pagin = jQuery('#pagin_page_' + id);
- var nb_elem = jQuery('#pagin_nb_' + id);
- var page_list = jQuery('#page_list_' + id);
- page_list.find('li').each(function () {
- jQuery(this).removeClass('active');
- });
- page_list.find('#page_' + page + '_' + id).addClass('active');
- pagin.val(page);
- nb_elem.val(nb);
- datagridv2_reload(id);
- }
- function datagridv2_reset(id) {
- var form = jQuery('#datagridForm_' + id);
- form.find('.datagridFilter').each(function () {
- jQuery(this).val("");
- });
- form.find('#order_by_' + id).val("")
- datagridv2_reload(id);
- }
- function datagridv2_saveInput(id) {
- // Loader
- showSpinner();
- var form = jQuery('#datagridForm_' + id);
- var saveTarget = form.find('#save_target_' + id).val();
- var data = {};
- jQuery('#divSaveMessage_' + id).html('');
- data = datagridv2_getFormData(id, true);
- jQuery.ajax({
- type: 'POST',
- url: saveTarget,
- data: data,
- success: function (response) {
- datagrid_save(response, id)
- }
- });
- }
- function datagrid_save(response, id)
- {
- hideSpinner();
- datagridv2_reload(id);
- jQuery('#divSaveMessage_' + id).html('');
- if (undefined != response) {
- response = JSON.parse(response);
- }
- jQuery('#tbody_' + id).find('.inputData.changeDatagridInput').each(function () {
- if (undefined == response || response.error == false
- || (response.error == true && response.id[jQuery(this).parents('tr').attr('id')] != jQuery(this).parents('tr').attr('id'))) {
- jQuery(this).removeClass('changeDatagridInput');
- jQuery('#save_button_' + id).attr('disabled', 'disabled');
- }
- });
- if (undefined !== response && undefined !== response.message) {
- // datagridv2_reset(id);
- jQuery('#divSaveMessage_' + id).html('<div class="alert ' + (response.error ? "alert-error" : "alert-success") + '"><span style="font-weight: 700;font-size: 20px;">' + response.message + '</span></div>');
- }
- jQuery('body').animate({
- scrollTop: 0
- }, 1000);
- }
- function datagridv2_getFormData(id, include_inputs) {
- // HTTPRequest
- var form = jQuery('#datagridForm_' + id);
- var advancedform = jQuery('#datagridAdvancedForm_' + id);
- var target = form.attr('action');
- var data = {};
- // for cake...
- data.data = {};
- data.data.filters = {};
- data.data.order_by = [];
- data.data.paginate = {};
- data.data.input = [];
- if (include_inputs) {
- var inputs = {};
- form.find('.changeDatagridInput').closest('tr').find('.inputData').each(function () {
- var temp = {};
- parse_str(jQuery(this).attr('name') + "=" + jQuery(this).val(), temp);
- inputs = array_replace_recursive(inputs, temp);
- });
- data.data.input = inputs.inputData;
- }
- form.find('.datagridFilter').each(function () {
- if (jQuery(this).val() != "") {
- if (data.data.filters[jQuery(this).attr('name')] == undefined)
- data.data.filters[jQuery(this).attr('name')] = {};
- data.data.filters[jQuery(this).attr('name')]['value'] = jQuery(this).val();
- }
- });
- advancedform.find('.datagridFilter').each(function () {
- if (jQuery(this).val() != "") {
- if (data.data.filters[jQuery(this).attr('name')] == undefined)
- data.data.filters[jQuery(this).attr('name')] = {};
- data.data.filters[jQuery(this).attr('name')]['value'] = jQuery(this).val();
- }
- });
- advancedform.find('.datagridAdvanceFilter').each(function () {
- if (jQuery(this).val() != "") {
- if (data.data.filters[jQuery(this).attr('name')] == undefined)
- data.data.filters[jQuery(this).attr('name')] = {};
- data.data.filters[jQuery(this).attr('name')]['operator'] = jQuery(
- this).val();
- }
- });
- if (form.find('#order_by_' + id).val() !== '')
- data.data.order_by.push(form.find('#order_by_' + id).val());
- form.find('.paginationField').each(function () {
- if (jQuery(this).val() != "") {
- data.data.paginate[jQuery(this).attr('name')] = jQuery(this).val();
- }
- });
- data._securityToken = form.find('[name=_securityToken]').val();
- return data;
- }
- /**
- * posts the data to the refresh action populates the data refreshes the
- * datagrid and return a Promise so you can run an action on promise resolve
- *
- * @return Promise
- * @param id String Datagrid id
- */
- function datagridv2_reload(id) {
- // Loader
- showSpinner();
- var form = jQuery('#datagridForm_' + id);
- var target = form.attr('action');
- var data = datagridv2_getFormData(id);
- jQuery('#divSaveMessage_' + id).html('');
- return jQuery.ajax({
- type: 'POST',
- url: target,
- data: data,
- success: function (response) {
- jQuery("#datagridData_" + id).html(response);
- // refreshContent
- datagridv2_refresh(id);
- // end loader
- hideSpinner();
- }
- });
- }
- /**
- * refreshes the datagrid with the data present (as json) in the page
- *
- * @param string
- * id datagrid id
- */
- function datagridv2_refresh(id) {
- // getData
- var data = datagridv2_getData(id);
- if (data === false) {
- console.error("datagrid " + id + " failed to reload");
- return false;
- }
- // Render data
- datagridv2_render(id, data);
- handle_delete_link(id);
- // trigger a generic event
- // var event = new Event('datagrid_refresh_' + id);
- // window.dispatchEvent(event);
- // /!\ warning /!\
- // Above lines don't work in IE
- // so, the following is a replacement.
- function CustomEvent(event, params) {
- params = params || {bubbles: false, cancelable: false, detail: undefined};
- var evt = document.createEvent('CustomEvent');
- evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
- return evt;
- }
- CustomEvent.prototype = window.Event.prototype;
- window.CustomEvent = CustomEvent;
- var event = new CustomEvent('datagrid_refresh_' + id);
- window.dispatchEvent(event);
- return true;
- }
- /**
- * translates the data present in the div : datagridData_<id> and returns the
- * jsonDecoded content
- *
- * @param string
- * id datagrid id
- */
- function datagridv2_getData(id) {
- var ret = [];
- try {
- ret = JSON.parse(jQuery("#datagridData_" + id).html());
- } catch (e) {
- console.error("Datagrid V2 Parsing error:", e);
- return false;
- }
- return ret;
- }
- /**
- * builds up lines in the datagrid table with the given dataset
- *
- * @param string
- * id datagrid id
- * @param string
- * data data to build table lines with
- */
- function datagridv2_render(id, data) {
- _renderContent(id, data);
- _renderPagin(id, data.condition.paginate);
- datagridv2_executeReadyFunction(id);
- }
- function datagridv2_executeReadyFunction(id) {
- if (!empty(datagridv2_readyFunctions[id])) {
- var target = jQuery('#' + id);
- for (var i = 0; i < datagridv2_readyFunctions[id].length; i++) {
- datagridv2_readyFunctions[id][i](id, target);
- }
- }
- }
- function countProperties(obj) {
- var count = 0;
- for (var prop in obj) {
- if (obj.hasOwnProperty(prop))
- ++count;
- }
- return count;
- }
- function _renderContent(id, data) {
- var contentData = data.data;
- if (!Array.isArray(contentData)) {
- console.error("Datagrid V2 Render error: jsonData should be array, "
- + typeof contentData + " given");
- return false;
- }
- if (data.meta['adding_row'] && data.meta['editable']) {
- var empty_row = {_id: null};
- jQuery.each(data.header, function (column) {
- if (column != 'actions') {
- empty_row[column] = '';
- } else {
- empty_row['actions'] = [];
- }
- });
- data.data.push(empty_row);
- }
- var content = '';
- var totalLines = contentData.length;
- for (var line = 0; line < totalLines; line++) {
- var lineClass = (line % 2 == 0) ? 'even' : '';
- var columnIndice = 0;
- lineId = ('undefined' != typeof contentData[line]['_id']) ? contentData[line]['_id'] : '';
- lineClass = ('undefined' != typeof contentData[line]['_class']) ? contentData[line]['_class'] : '';
- if ('' != lineId) {
- content += '<tr class="' + lineClass + '" id="line_' + id + "_" + lineId + '">';
- } else {
- content += '<tr class="' + lineClass + '">';
- }
- for (column in contentData[line]) {
- if (column == "_id" || column == "_class")
- continue;
- content += '<td id="' + id + "_" + lineId + '_' + 'column_' + columnIndice + '" class="' + id + "_" + 'column_' + columnIndice;
- if (data.header[column] !== undefined && data.header[column].class !== undefined)
- content += ' ' + data.header[column].class;
- if (contentData[line][column] !== null && contentData[line][column] !== undefined && contentData[line][column]['class'] !== null && contentData[line][column]['class'] !== undefined)
- content += ' ' + contentData[line][column]['class'];
- content += '">';
- columnIndice++;
- if (data.meta['editable'] && column != 'actions') {
- // print Inputs
- fieldName = 'inputData[' + lineId + '][' + column + ']';
- if (!empty(data.input) && !empty(data.input[column])) {
- if (data.input[column]['type'] == "text") {
- content += '<input class="inputData form-control" type="text" value="'
- + contentData[line][column]
- + '" name="'
- + fieldName + '" />';
- } else if (data.input[column]['type'] == "select"
- && typeof data.input[column]['value'] === 'object') {
- content += '<select class="inputData form-control" name="'
- + fieldName + '" >';
- content += '<option value="#"></option>';
- for (selectValue in data.input[column]['value']) {
- if (data.input[column]['value'][selectValue] !== '') {
- content += '<option value="'
- + selectValue + '" '
- + (selectValue == contentData[line][column] ? "selected='selected'"
- : "") + '>';
- content += data.input[column]['value'][selectValue];
- content += '</option>';
- }
- }
- content += "</select>";
- } else if (data.input[column]['type'] == "checkbox") {
- content += '<input class="inputData form-control" type="checkbox" value="'
- + contentData[line][column]
- + '" checked="'
- + (contentData[line][column] ? 'checked' : '')
- + '" + name="'
- + fieldName
- + '" />'
- + contentData[line][column];
- } else if (data.input[column]['type'] == "textarea") {
- content += '<textarea class="inputData form-control" name="'
- + fieldName + '" >' + contentData[line][column]
- + '</textarea>';
- }
- } else {
- content += (contentData[line][column] ? contentData[line][column] : '');
- }
- } else if (!Array.isArray(contentData[line][column])) {
- if (contentData[line][column] === undefined || contentData[line][column] === null)
- content += '';
- else if (typeof (contentData[line][column]) == 'object' && contentData[line][column]['data'] !== undefined && contentData[line][column]['data'] !== null)
- content += contentData[line][column]['data'];
- else if (contentData[line][column] !== undefined && contentData[line][column] !== null)
- content += contentData[line][column];
- } else { // actions
- var totalActions = contentData[line][column].length;
- for (var action = 0; action < totalActions; action++) {
- if (contentData[line][column][action]['custom'] !== undefined) {
- content += '<' + contentData[line][column][action]['custom']['tag'];
- var totalAttributes = countProperties(contentData[line][column][action]['custom']['attributes']);
- var keyAttribute = valueAttribute = '';
- for (var attributes = 0; attributes < totalAttributes; attributes++) {
- var keyValueAttribut = 0;
- if ((undefined !== Object) && (null !== Object)) {
- jQuery.each(contentData[line][column][action]['custom']['attributes'], function (keyAttribute, valueAttribute) {
- if (('' !== keyAttribute) && ('' !== valueAttribute)) {
- content += ' ' + keyAttribute + '="' + valueAttribute + '"';
- }
- });
- }
- }
- if (undefined !== contentData[line][column][action]['custom']['value']) {
- content += '>';
- if (undefined !== contentData[line][column][action]['custom']['icon'])
- content += '<i class="' + contentData[line][column][action]['custom']['icon'] + ' datagrid-icon"></i> ';
- content += '<span class="datagrid-text">' + contentData[line][column][action]['custom']['value'] + '</span>';
- content += '</' + contentData[line][column][action]['custom']['tag'] + '>';
- } else {
- content += '/>';
- }
- } else {
- if (contentData[line][column][action]['title'] === undefined)
- var title = contentData[line][column][action]['icon'];
- else
- var title = contentData[line][column][action]['title'];
- content += '<a class="icon-'
- + contentData[line][column][action]['icon']
- + '" href="'
- + contentData[line][column][action]['href'];
- if (contentData[line][column][action]['onclick'] != undefined) {
- content += '" onclick="'
- + contentData[line][column][action]['onclick'];
- }
- content += '" title="'
- + title;
- if (contentData[line][column][action]['data-id'] !== undefined)
- content += '" data-id="' + contentData[line][column][action]['data-id'];
- var attrs = contentData[line][column][action]['attributes'];
- for (var attr in attrs) {
- if (attrs.hasOwnProperty(attr)) {
- content += '" ' + attr + '="' + attrs[attr];
- }
- }
- content += '">';
- content += "</a>";
- }
- // CHANGE END
- }
- }
- content += '</td>';
- }
- content += '</tr>';
- }
- jQuery('#save_button_' + id).unbind('click').click(function () {
- datagridv2_saveInput(id);
- });
- jQuery('#results_' + id).html(totalLines);
- jQuery('#tbody_' + id).html(content).find('.inputData').each(function () {
- jQuery(this).bind('input propertychange', function (e) {
- jQuery(this).addClass('changeDatagridInput');
- jQuery('#save_button_' + id).removeAttr('disabled');
- });
- });
- if (content != '') {
- jQuery('#tbody_no_result_' + id).hide();
- } else//case where there is no data
- {
- jQuery('#tbody_no_result_' + id).show();
- }
- return true;
- }
- function datagridv2_toggle_advanced_filter2(selector) {
- if (selector.find(':selected').attr('data-double') === 'true')
- selector.parent().find('.datagridFilter2').show();
- else {
- selector.parent().find('.datagridFilter2').hide();
- selector.parent().find('.datagridFilter2').val('');
- }
- }
- window.smoothScrollTo = (function () {
- var timer, start, factor;
- return function (target, duration) {
- var offset = window.pageYOffset,
- delta = target - window.pageYOffset; // Y-offset difference
- duration = duration || 1000; // default 1 sec animation
- start = Date.now(); // get start time
- factor = 0;
- if (timer) {
- clearInterval(timer); // stop any running animations
- }
- function step() {
- var y;
- factor = (Date.now() - start) / duration; // get interpolation factor
- if (factor >= 1) {
- clearInterval(timer); // stop animation
- factor = 1; // clip to max 1.0
- }
- y = factor * delta + offset;
- window.scrollBy(0, y - window.pageYOffset);
- }
- timer = setInterval(step, 10);
- return timer;
- };
- }());
- function goToSmoothScrollId(id) {
- var top_div = parseInt(jQuery('#' + id).offset().top) - 87;//top - header_size - close_button_size
- smoothScrollTo(top_div);
- }
- function goToSmoothScrollClass(id) {
- var top_div = parseInt(jQuery('.' + id).offset().top) - 87;//top - header_size - close_button_size
- smoothScrollTo(top_div);
- }
- jQuery(document).ready(function () {
- jQuery('.datagridAdvancedSearchClose').hide();
- jQuery('.datagridAdvanceFilter').each(function () {
- datagridv2_toggle_advanced_filter2(jQuery(this));
- });
- jQuery('.datagridAdvanceFilter').change(function () {
- datagridv2_toggle_advanced_filter2(jQuery(this));
- });
- jQuery('#hideFilterSearch').on('click', function () {
- jQuery('.datagridAdvancedSearch').hide();
- jQuery('.datagridAdvancedSearchClose').show();
- goToSmoothScrollClass('datagridAdvancedSearch');
- });
- jQuery('#showFilterSearch').on('click', function () {
- jQuery('.datagridAdvancedSearch').show();
- jQuery('.datagridAdvancedSearchClose').hide();
- goToSmoothScrollClass('datagridAdvancedSearch');
- });
- });
- function _renderPagin(id, paginData) {
- if (!paginData) {
- return false;
- }
- if ((typeof paginData) != 'object') {
- console.error("Datagrid V2 Pagination Render error: paginData should be object, " + typeof paginData + " given");
- return false;
- }
- if (!paginData.hasOwnProperty("page") ||
- !paginData.hasOwnProperty("nb") ||
- !paginData.hasOwnProperty("page_total") ||
- !paginData.hasOwnProperty("nb_total")) {
- console.error("Datagrid V2 Pagination Render error: paginData is missing properties");
- return false;
- }
- var datagrid = jQuery('#' + id);
- var pageList = datagrid.find('#page_list_' + id);
- var displayedNb = datagrid.find('#total_results_' + id);
- var listContent = "";
- var max_pages = 12;
- var max_range = 3;
- var min_page = (paginData.page - max_range < 1) ? 1 : paginData.page - max_range;
- var max_increment = (paginData.page + max_range > paginData.page_total) ? paginData.page_total : paginData.page + max_range;
- if (paginData.page_total <= max_pages) {
- for (var i = 1; i <= paginData.page_total; i++) {
- listContent += '<li id="page_' + i + '_' + id + '" ';
- listContent += 'onclick="datagridv2_pagin(\'' + id + '\', ' + i + ', \''
- + paginData.nb + '\');" ';
- listContent += 'class="' + ((i == paginData.page) ? "active" : '')
- + '">';
- listContent += '<span>' + i + '</span>';
- listContent += '</li>';
- }
- } else {
- if (min_page > 1) {
- listContent += '<li onclick="datagridv2_pagin(\'' + id + '\', ' + 1 + ', \'' + paginData.nb + '\');" ><span > << </span></li>';
- listContent += '<li><span style="background-color: inherit; border: none; cursor: auto;"> ... </span></li>';
- }
- for (var i = min_page; i <= max_increment; i++) {
- listContent += '<li id="page_' + i + '_' + id + '" ';
- listContent += 'onclick="datagridv2_pagin(\'' + id + '\', ' + i + ', \''
- + paginData.nb + '\');" ';
- listContent += 'class="' + ((i == paginData.page) ? "active" : '')
- + '">';
- listContent += '<span>' + i + '</span>';
- listContent += '</li>';
- }
- if (max_increment < paginData.page_total) {
- listContent += '<li><span style="background-color: inherit; border: none; cursor: auto;"> ... </span></li>';
- listContent += '<li onclick="datagridv2_pagin(\'' + id + '\', ' + paginData.page_total + ', \'' + paginData.nb + '\');" ><span > >> </span></li>';
- }
- }
- pageList.html(listContent);
- displayedNb.html(paginData.nb_total);
- return true;
- }
- function datagridv2_select_nb_elems(id) {
- // get value
- var selectedNb = jQuery("#select_nb_elems_" + id).val();
- var totalNb = jQuery("#pagin_nb_total_" + id).val();
- // calc hidden fields
- jQuery("#pagin_page_" + id).val(1);
- jQuery("#pagin_nb_" + id).val(selectedNb);
- jQuery("#pagin_page_total_" + id).val(Math.ceil(totalNb / selectedNb));
- // refresh
- datagridv2_reload(id);
- }
- function empty(content) {
- return typeof content == 'undefined' || content == '' || content == [];
- }
- function parse_str(str, array) {
- var strArr = String(str).replace(/^&/, '').replace(/&$/, '').split('&'), sal = strArr.length, i, j, ct, p, lastObj, obj, lastIter, undef, chr, tmp, key, value, postLeftBracketPos, keys, keysLen, fixStr = function (
- str) {
- return decodeURIComponent(str.replace(/\+/g, '%20'));
- };
- if (!array) {
- array = this.window;
- }
- for (i = 0; i < sal; i++) {
- tmp = strArr[i].split('=');
- key = fixStr(tmp[0]);
- value = (tmp.length < 2) ? '' : fixStr(tmp[1]);
- while (key.charAt(0) === ' ') {
- key = key.slice(1);
- }
- if (key.indexOf('\x00') > -1) {
- key = key.slice(0, key.indexOf('\x00'));
- }
- if (key && key.charAt(0) !== '[') {
- keys = [];
- postLeftBracketPos = 0;
- for (j = 0; j < key.length; j++) {
- if (key.charAt(j) === '[' && !postLeftBracketPos) {
- postLeftBracketPos = j + 1;
- } else if (key.charAt(j) === ']') {
- if (postLeftBracketPos) {
- if (!keys.length) {
- keys.push(key.slice(0, postLeftBracketPos - 1));
- }
- keys.push(key.substr(postLeftBracketPos, j
- - postLeftBracketPos));
- postLeftBracketPos = 0;
- if (key.charAt(j + 1) !== '[') {
- break;
- }
- }
- }
- }
- if (!keys.length) {
- keys = [key];
- }
- for (j = 0; j < keys[0].length; j++) {
- chr = keys[0].charAt(j);
- if (chr === ' ' || chr === '.' || chr === '[') {
- keys[0] = keys[0].substr(0, j) + '_'
- + keys[0].substr(j + 1);
- }
- if (chr === '[') {
- break;
- }
- }
- obj = array;
- for (j = 0, keysLen = keys.length; j < keysLen; j++) {
- key = keys[j].replace(/^['"]/, '').replace(/['"]$/, '');
- lastIter = j !== keys.length - 1;
- lastObj = obj;
- if ((key !== '' && key !== ' ') || j === 0) {
- if (obj[key] === undef) {
- obj[key] = {};
- }
- obj = obj[key];
- } else { // To insert new dimension
- ct = -1;
- for (p in obj) {
- if (obj.hasOwnProperty(p)) {
- if (+p > ct && p.match(/^\d+$/g)) {
- ct = +p;
- }
- }
- }
- key = ct + 1;
- }
- }
- lastObj[key] = value;
- }
- }
- }
- function array_replace_recursive(arr) {
- // discuss at: http://phpjs.org/functions/array_replace_recursive/
- // original by: Brett Zamir (http://brett-zamir.me)
- // example 1: array_replace_recursive({'citrus' : ["orange"], 'berries' :
- // ["blackberry", "raspberry"]}, {'citrus' : ['pineapple'], 'berries' :
- // ['blueberry']});
- // returns 1: {citrus : ['pineapple'], berries : ['blueberry', 'raspberry']}
- var retObj = {}, i = 0, p = '', argl = arguments.length;
- if (argl < 2) {
- throw new Error(
- 'There should be at least 2 arguments passed to array_replace_recursive()');
- }
- // Although docs state that the arguments are passed in by reference, it
- // seems they are not altered, but rather the copy that is returned (just
- // guessing), so we make a copy here, instead of acting on arr itself
- for (p in arr) {
- retObj[p] = arr[p];
- }
- for (i = 1; i < argl; i++) {
- for (p in arguments[i]) {
- if (retObj[p] && typeof retObj[p] === 'object') {
- retObj[p] = this.array_replace_recursive(retObj[p],
- arguments[i][p]);
- } else {
- retObj[p] = arguments[i][p];
- }
- }
- }
- return retObj;
- }
- function showSpinner() {
- jQuery('.datagrid-backdrop').addClass('in');
- }
- function hideSpinner() {
- jQuery('.datagrid-backdrop').removeClass('in');
- }
- function handle_delete_link(id) {
- jQuery('#' + id + ' .delete-datagrid').click(function () {
- let link = jQuery(this);
- let confirmText = link.data('confirm-text');
- let dataId = link.data('id');
- if (typeof dataId != 'undefined') {
- if (typeof confirmText != 'undefined') {
- if (!confirm(confirmText)) {
- return false;
- }
- }
- jQuery.ajax({
- url: link.attr('href'),
- method: "POST",
- data: {id: dataId, '_securityToken': jQuery('#' + id + ' [name=_securityToken]').val()}
- }).done(function (response) {
- if (response != 'undefined') {
- let response = JSON.parse(response)
- jQuery('#divSaveMessage_' + id).html('<div class="alert ' + (response.error ? "alert-error" : "alert-success") + '"><span style="font-weight: 700;font-size: 20px;">' + response.message + '</span></div>')
- }
- });
- datagridv2_reload(id)
- }
- return false
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement