jQuery UI Widgets Forums Grid Grid,update,columngroup

This topic contains 2 replies, has 2 voices, and was last updated by  Zabelsky 6 years, 11 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • Grid,update,columngroup #97043

    Zabelsky
    Participant

    Hello,friend.
    I have a question.
    How to correct update columngroup?

    I have same code :

     $scope.settings.columns = [
                    { text: "Напр", datafield: "_direction", width: 25, filtertype: 'checkedlist', resizable: false, cellsrenderer: asColumnRender, editable: false, type: "string", pinned: true, rendered: tooltiprenderer },
                    { text: "Рег.Номер", datafield: "_RegistrationNumbers", width: 90, resizable: false, cellsrenderer: asColumnRender, editable: false, type: "string", pinned: true, rendered: tooltiprenderer },
                    { text: "Караван", datafield: "_caravansForTractor", width: 90, type: "string", filtertype: 'checkedlist', cellsrenderer: caravanRender, editable: false, rendered: tooltiprenderer },
                    { text: "Блок", datafield: "_blocksForTractor", width: 80, type: "string", filtertype: 'checkedlist', cellsrenderer: blockRender, editable: false, rendered: tooltiprenderer },
                    { text: "Экипаж", datafield: "_Drivers", width: 100, cellsrenderer: asColumnRender, resizable: true, editable: false, type: "string", rendered: tooltiprenderer },
                    { text: "Вр. прицеп", datafield: "_TempTrailerNumber", width: 70, cellsrenderer: asColumnRender, editable: false, type: "string", rendered: tooltiprenderer },
                    { text: "Приписка", datafield: "_Registration", width: 40, filtertype: 'checkedlist', cellsrenderer: asColumnRender, editable: false, type: "string", rendered: tooltiprenderer },
                    { text: "Группа", datafield: "_GroupAvto", width: 40, filtertype: 'checkedlist', cellsrenderer: asColumnRender, editable: false, type: "string", rendered: tooltiprenderer },
                    { text: "Тип прицепа", datafield: "TrailerType", width: 40, filtertype: 'checkedlist', columntype: 'combobox', cellsrenderer: asColumnRender, createeditor: createeditorTrailerType, cellendedit: rowEditTrailerType, rendered: tooltiprenderer },
                    { text: "Разрешения", datafield: "_GroupPlacement", width: 80, columntype: 'combobox', cellsrenderer: asColumnRender, createeditor: createeditorGroup, cellendedit: rowEditGroup, rendered: tooltiprenderer },
                    { text: "Визы", datafield: "_Visa", width: 80, cellsrenderer: visasRender, editable: false, cellsformat: 'dd.MM.yyyy', rendered: tooltiprenderer },
                    { text: "Этап", datafield: "_Orders", width: 300, cellsrenderer: asColumnRenderOrder, editable: false, type: "string", rendered: tooltiprenderer },
                    { text: "ЭПИ", datafield: "_Expenses", width: 80, cellsrenderer: asColumnRender, editable: false, type: "int", rendered: tooltiprenderer },
                    { text: "Простои(дн)", datafield: "_DowntimeDays", cellsrenderer: downtimeDays, width: 50, editable: false, type: "int", rendered: tooltiprenderer },
                    { text: "Неделя", datafield: "_Week", width: 50, filtertype: 'checkedlist', cellsrenderer: asColumnRender, editable: false, type: "int", rendered: tooltiprenderer },
                    { text: "Инженер", datafield: "Leading", width: 90, filtertype: 'checkedlist', cellsrenderer: asColumnRender, editable: false, type: "string", rendered: tooltiprenderer },
                    { text: "Клиент", datafield: "_Clients", width: 250, cellsrenderer: asColumnRenderForClient, editable: false, type: "string", rendered: tooltiprenderer },
                    { text: "КТ", datafield: "_Client", width: 10, filtertype: 'checkedlist', cellsrenderer: asColumnRenderForClient, editable: false, type: "string", rendered: tooltiprenderer },
                    { text: "КП", datafield: "_ClientP", width: 10, filtertype: 'checkedlist', cellsrenderer: asColumnRenderForClient, editable: false, type: "string", rendered: tooltiprenderer },
                    { text: "KTS", datafield: "_Clientstr", width: 10, cellsrenderer: asColumnRenderForClient, editable: false, type: "string", rendered: tooltiprenderer },
                    { text: "KPS", datafield: "_Clientpstr", width: 10, cellsrenderer: asColumnRenderForClient, editable: false, type: "string", rendered: tooltiprenderer },
                    { text: "Маршрут 1", datafield: "_RoutesFirst", width: 50, filtertype: 'checkedlist', editable: false, cellsrenderer: asColumnRender, type: "string", access: "Administrator,Leading", accessPermissionType: "AtLeastOne", rendered: tooltiprenderer },
                    { text: "Маршрут 2", datafield: "_RoutesSecond", width: 50, filtertype: 'checkedlist', editable: false, cellsrenderer: asColumnRender, type: "string", access: "Administrator,Leading", accessPermissionType: "AtLeastOne", rendered: tooltiprenderer },
                    { text: "Экспедитор", datafield: "_Forwarders", cellsrenderer: asColumnRender, width: 90, editable: false, type: "string", rendered: tooltiprenderer },
                    { text: "Загрузка", datafield: "_LoadingDates", cellsrenderer: asColumnRender, width: 80, editable: false, type: "date", cellsformat: 'dd.MM', rendered: tooltiprenderer },
                    { text: "Разгрузка", datafield: "_UploadingDates", cellsrenderer: asColumnRender, width: 80, editable: false, type: "date", cellsformat: 'dd.MM.', rendered: tooltiprenderer },
                    { text: "Растаможка", datafield: "_CustomClearanceDates", cellsrenderer: asColumnRender, editable: false, width: 80, type: "date", cellsformat: 'dd.MM', rendered: tooltiprenderer },
                    { text: "Пл. Загр.", datafield: "_LastLoadingDates", cellsrenderer: dateLoadingRender, width: 90, editable: false, type: "string", cellsformat: 'dd.MM', rendered: tooltiprenderer },
                    { text: "Пл. Раст.", datafield: "_PlaneCustomClearanceDates", cellsrenderer: asColumnRender, width: 90, editable: false, type: "date", cellsformat: 'dd.MM', rendered: tooltiprenderer },
                    { text: "Пл. Разгр.", datafield: "_LastUploadingDates", cellsrenderer: dateUploadingRender, width: 90, editable: false, type: "date", cellsformat: 'dd.MM', rendered: tooltiprenderer },
                    { text: "Разг. Тек", datafield: "_Uploadings", cellsrenderer: asColumnRender, width: 90, editable: false, type: "string", rendered: tooltiprenderer },
                    { text: "Разг. Кв()", datafield: "_UploadingsSort", filtertype: 'checkedlist', cellsrenderer: asColumnRender, width: 90, editable: false, type: "string", rendered: tooltiprenderer },
                    { text: "Комм. этапа", datafield: "_CommentOrders", cellsrenderer: asColumnRender, width: 90, editable: false, type: "string", rendered: tooltiprenderer },
                    { text: "Комм. авто", datafield: "_TrailerComment", cellsrenderer: asColumnRender, width: 90, editable: false, type: "string", rendered: tooltiprenderer },
                    { text: "Комм. мех.", datafield: "_MechanikComment", cellsrenderer: asColumnRender, width: 90, editable: false, type: "string", rendered: tooltiprenderer },
                    { text: "Комм. планир.", datafield: "PlanComment", cellsrenderer: asColumnRender, width: 120, cellendedit: rowEdit, type: "string", rendered: tooltiprenderer },
                    { text: "Комм. по разреш.", datafield: "PlanResolution", cellsrenderer: asColumnRender, cellendedit: rowEditCommentResolution, width: 120, type: "string", rendered: tooltiprenderer },
                    { text: "Комм. экспорт", datafield: "ExportComment", cellsrenderer: asColumnRender, cellendedit: rowEditExportComment, width: 100, type: "string", rendered: tooltiprenderer },
                    { text: "Комм. инженера", datafield: "EngineerComment", cellsrenderer: asColumnRender, cellendedit: rowEditEngineerComment, width: 100, type: "string", rendered: tooltiprenderer }
                ];
                $scope.settings.columngroups = [
                    { text: 'Календарь', align: 'center', name: 'Calendar' }
                ];
    
                if (typeof $scope.calendarStart == 'undefined' || $scope.calendarStart !== new Date() && !$scope.calendarFlag) {
                    $scope.changeCalendarForGrid();
                }
                var firstDate = $scope.calendarStart;
                var secondDate = $scope.calendarEnd;
                var diffDays = Math.round(Math.abs((firstDate.getTime() - secondDate.getTime()) / (oneDay)));
                $scope.datafields = [];
                for (var k = 0; k <= diffDays; k++) {
                    var date = new Date();
                    date = firstDate.addDays(k);
                    var day = date.getDate();
                    var month = date.getMonth() + 1;
                    var datafield = '_Date_' + month + '_' + day;
                    $scope.settings.columns.push({ text: day + '-' + getDayOfWeek(date.getDay()), datafield: datafield, columnsreorder: false, width: 50, draggable: false, type: "string", columngroup: 'Calendar', cellsrenderer: calendarRender });
                    $scope.datafields.push(datafield);
                }

    but at some point me need to change columngroup
    i change date at input and press the update
    my “update” code :

    $scope.refreshGrid = function() {
              $('#grid_disposition_main').jqxGrid('beginupdate');
                var firstDate = $scope.calendarStart;
                var secondDate = $scope.calendarEnd;
                var diffDays = Math.round(Math.abs((firstDate.getTime() - secondDate.getTime()) / (oneDay)));
                $scope.datafields = [];
                for (var k = 0; k <= diffDays; k++) {
                    var date = firstDate.addDays(k);
                    var day = date.getDate();
                    var month = date.getMonth() + 1;
                    var datafield = '_Date_' + month + '_' + day;
                    $scope.settings.columns.push({ text: day + '-' + getDayOfWeek(date.getDay()), datafield: datafield, columnsreorder: false, width: 80, type: "string", columngroup: 'Calendar', cellsrenderer: calendarRender, editable: false });
                    $scope.datafields.push(datafield);
                }                   
                $('#grid_disposition_main').jqxGrid('endupdate');
            }
    Grid,update,columngroup #97080

    Hristo
    Participant

    Hello AlexeyZabelsky,

    The mentioned approach is good. It looks like you want to make updates on all columns.
    If we pay attention to the topic title and you want to update the “columngroup”.
    I would like to suggest you look at this approach. (You could use beginupdate and endupdate as a ‘quotes’, again.)

    Best Regards,
    Hristo Hristov

    jQWidgets team
    http://www.jqwidgets.com

    Grid,update,columngroup #97279

    Zabelsky
    Participant

    Thx for help,Hristo.
    have a good day

    Best Regards,
    Alexey Zabelsky

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.