jQWidgets Forums

jQuery UI Widgets Forums Grid Filter not working for one user

This topic contains 1 reply, has 2 voices, and was last updated by  Hristo 6 years, 6 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • Filter not working for one user #102593

    airborne13b27
    Participant

    Hello, I work in a small department at a school district and we’ve built our own work order program using jqxgrid that several of us use daily. The filtertype:input filters are working for all but one person. I know this is probably not related to a problem with the code since it works for the rest of us, but could you maybe provide some guidance on what may cause this? I’ve provided the code below just in case it helps. Thanks.

            function initGrid(view, filterstring, queues) {
                var profile = JSON.parse($("#profile").val());
                if (queues == "") {
                    queues = JSON.parse($("#queues").val());
                }
                //console.log(queues);
                if (profile.Role == "HelpDeskAdmin") {
                    $('#IncidentsOnly').show();
                }
                var dayCounter = function (row, columnfield, value) {
                    var defaultclass;
                    var days = $('#incidentGrid').jqxGrid('getcellvalue', row, 'DaysOld');
                    if (days < 7) {
                        defaultclass = 'clear';
                    }
                    else if (days > 6 && days < 14) {
                        defaultclass = 'yellow';
                    }
                    else if (days >= 14) {
                        defaultclass = 'red';
                    }
                    return defaultclass;
                }
                var checkForAccessRequest = function (row, columnfield, value, defaulthtml, columnproperties) {
                    if (value.substring(0, 13) == "Access Change") {
                        var requestItems = value.split("~");
                        value = requestItems[0];
                    }
                    return "<div class='returnColumn'>" + value + "</div>";
                }
                var queueColumn = function (row, columnfield, value, defaulthtml, columnproperties) {
                    var html = "";
                    if (profile.Role == "HelpDeskAdmin") {
                        html = "<div class='returnColumn'><select style='top:-25px;' onchange='updateQueue(this, "+ row +")'>";
                        for (var i = 0; i < queues.length; i++) {
                            html += "<option value='" + queues[i].QueueID + "'";
                            if (value == queues[i].Queue) {
                                html += " selected ";
                            }
                            html += ">" + queues[i].Queue + "</option>";
                        }    
                        html += "</select></div>";
                    }
                    else {
                        html = "<div class='returnColumn'>" + value + "</div>";
                    }
                    return html;
                }
                var queueids = profile.QueueIDs;
                var incidentQueueOnly = $("#viewIncidentsOnly").is(":checked");
                if (incidentQueueOnly) {
                    queueids = "10";
                }
                var URL = "_data.aspx?qt=helpdeskqueue&queueids=" + queueids;
                if (view == "closed") { URL = "_data.aspx?qt=viewclosed&queueids=" + queueids; }
                var source = {
                    datafields: [
                        { name: 'IncidentID', type: 'string' },
                        { name: 'StatusName', type: 'string' },
                        { name: 'School', type: 'string' },
                        { name: 'Description', type: 'string' },
                        { name: 'DaysOld', type: 'int' },
                        { name: 'OpenedDate', type: 'date' },
                        { name: 'QueueID', type: 'string' },
                        { name: 'QueueName', type: 'string' },
                        { name: 'CategoryName', type: 'string' },
                        { name: 'ClientName', type: 'string' },
                        { name: 'AssignedTo', type: 'string' }
                    ],
                    datatype: "json",
                    url: URL,
                    async: true
                };
                var dataAdapter = new $.jqx.dataAdapter(source);
    
                $("#incidentGrid").jqxGrid(
                {
                    width: '100%',
                    autoheight: true,
                    theme: 'berkeley',
                    source: dataAdapter,
                    sortable: true,
                    pageable: true,
                    pagesizeoptions: ['20', '50', '100'],
                    pagesize: 50,
                    columnsresize: true,
                    editable: false,
                    filterable: true,
                    showfilterrow: true,
                    enabletooltips: true,
                    selectionmode: "none",
                    columns: [
                      { text: 'Incident ID', datafield: 'IncidentID', width: '6%', filtertype: 'input', cellclassname: dayCounter, cellsalign: 'center' },
                      { text: 'Status', datafield: 'StatusName', width: '7%', filtertype: 'checkedlist', cellclassname: dayCounter },
                      { text: 'School', datafield: 'School', width: '5%', filtertype: 'checkedlist', cellclassname: dayCounter, cellsalign: 'center' },
                      { text: 'Client', datafield: 'ClientName', width: '8%', filtertype: 'input', cellclassname: dayCounter },
                      { text: 'Description', datafield: 'Description', width: '42%', filtertype: 'input', cellclassname: dayCounter, cellsrenderer: checkForAccessRequest },
                      { text: 'Days Old', datafield: 'DaysOld', width: '4%', filterable: false, cellclassname: dayCounter, cellsalign: 'center' },
                      { text: 'Opened', datafield: 'OpenedDate', width: '8%', filterable: false, cellclassname: dayCounter, cellsformat: 'M/d/yyyy h:mm tt', cellsalign: 'center' },
                      { text: 'Assigned To', datafield: 'AssignedTo', width: '8%', filtertype: "checkedlist", cellclassname: dayCounter },
                      { text: 'QueueID', datafield: 'QueueID', hidden: true },
                      { text: 'Queue', datafield: 'QueueName', width: '9%', filtertype: 'checkedlist', cellclassname: dayCounter, cellsrenderer: queueColumn },
                      { text: 'Category', datafield: 'CategoryName', width: '11%', filtertype: 'checkedlist', cellclassname: dayCounter }
                    ]
                });
                $("#incidentGrid").on("bindingcomplete", function (event) {
                    var allSettings = JSON.parse(filterstring);
                    //console.log(allSettings);
                    if (allSettings.Filters != "") {
                        var allfilters = allSettings.Filters;
                        var filtergroup = new $.jqx.filter();
                        var sets = allfilters.split("|");
                        for (var i = 0; i < sets.length; i++) {
                            var filterset = sets[i].split(";");
                            var filtervalue = filterset[1];
                            var filtercondition = filterset[2];
                            var filter_or_operator = filterset[3];
                            var filter1 = filtergroup.createfilter('stringfilter', filtervalue, filtercondition);
                            filtergroup.addfilter(filter_or_operator, filter1);
                            $("#incidentGrid").jqxGrid('addfilter', filterset[0], filtergroup);
                        }
                        $("#incidentGrid").jqxGrid('applyfilters');
                    }
                    if (allSettings.Sorting != "") {
                        var allSorting = allSettings.Sorting.split(";");
                        var column = allSorting[0];
                        var direction = allSorting[1];
                        $('#incidentGrid').jqxGrid('sortby', column, direction);
                    }
                    if (profile.Role == "SysAdmin" || profile.Role == "InfoSys") {
                        $('#incidentGrid').jqxGrid('hidecolumn', 'OpenedDate');
                    }
                    else {
                        $('#incidentGrid').jqxGrid('hidecolumn', 'AssignedTo');
                    }
                });
            }
    
    Filter not working for one user #102607

    Hristo
    Participant

    Hello airborne13b27,

    Could you clarify your issue?
    What you mean with this “filters are working for all but one person”?
    Is there any error message?
    Also, I would like to suggest you look at this demo. it could be helpful.

    Best Regards,
    Hristo Hristov

    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.