jQWidgets Forums

jQuery UI Widgets Forums Grid sorting

This topic contains 1 reply, has 2 voices, and was last updated by  Peter Stoev 7 years, 11 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    sorting Posts
  • sorting #94233

    Manowar
    Participant
                // данные для master grid
                var source =
                        {
                            datatype: "json",
                            datafields: [
    					         { name: "DocDate", type: "date" },
                                 { name: "RegNumber", type: "string" },
                                 { name: "UserID", type: "number" },
                                 { name: "RecordDate", type: "date" },
                                 { name: "RecordStatusID", type: "number" },
                                 { name: "RegistrationDate", type: "date" },
                                 { name: "Number", type: "string" },
                                 { name: "Description", type: "string" },
                                 { name: "DocumentTypeName", type: "string" },
                                 { name: "DocumentID", type: "number" },
                                 { name: "DocumentTypeID", type: "number" },
                                 { name: "ObjectID", type: "number" },
                                 { name: "Summa", type: "number" },
                                 { name: "ContragentName", type: "string" }
                            ],
                            id: "DocumentID",
                            url: "GetIncDocuments",
                            beforeprocessing: function (data) {
                                source.totalrecords = data[0].Total;
                            }
                    };
                
    
                var dataAdapter = new $.jqx.dataAdapter(source,
                    {
                        // центровка для иконки корзины
                        loadComplete: function () {
                            $("span[style*='top: 4px']").css("left", "2.5px");
                        }
                    }
                );
    
                // initialize jqxGrid
                $("#jqxgrid").jqxGrid(
                        {
                            width: 1000,
                            source: dataAdapter,
                            pageable: true,
                            autoheight: true,
                            sortable: true,
                            editable: true,
                            localization: getLocalization(),
                            showaggregates: true,
                            showstatusbar: true,
                            statusbarheight: 25,
                            altrows: true,
                            editmode: "selectedcell",
                            selectionmode: "singlerow",
                            
                            virtualmode: true,
                            rendergridrows: function (obj) {
                                return obj.data;
                            },
                            columns: [
                                {
                                    text: "", datafield: "RecordStatusID", editable: false, width: 10, sortable: false, //селектор строки
                                    cellsrenderer: function () {return "<div style='height: 100%; background-color: #EEEEEE'><span></span></div>";}
                                },
                                { text: "Дата", datafield: "DocDate", columntype: "datetimeinput", cellsformat: "dd.MM.yy", width: 120},
                                {
                                    text: "Тип", datafield: "DocumentTypeName", editable:false, cellsalign: "center", displayfield: "DocumentTypeName",
                                    width: 220, cellsrenderer: linkrenderer = function (row, columnfield, value, defaulthtml, columnproperties, rowdata) {
                                        return "<a style='display:block;margin-top:5px;margin-left:4px' href=\"/fooDocument/IncDocumentCard/"
                                            + rowdata.DocumentID + "\">" + value + "</a>";
                                    }
                                },
                                { text: "Номер", datafield: "Number", width: 100 },
                                { text: "Поставщик", datafield: "ContragentName", width: 120},
                                { text: "Описание", datafield: "Description",  width: 270, cellsrenderer: docRowCellsRenderer },
                                { text: "Сумма", datafield: "Summa", editable:false, cellsalign: "right", width: 120, cellsrenderer: disablecellsrenderer},
                                {
                                    text: "", datafield: "Delete", columntype: "button", sortable: false, width: 20,
                                    cellsrenderer: function (){ return "<span class='glyphicon glyphicon-trash' style='margin: auto'></span>"; }
                                }
                            ]
                        });

    Hello, can you tell me, please, why my sorting doesn’t work?

    sorting #94241

    Peter Stoev
    Keymaster

    Hi Manowar,

    You use the grid in Virtual Mode. This means that you should implement Server Side Sorting, Filtering and Paging.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

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

You must be logged in to reply to this topic.