ParamQuery grid support forum

General Category => ParamQuery Pro Evaluation Support => Topic started by: Ajay on June 12, 2015, 07:21:55 pm

Title: PQGrid not loading data in grid.
Post by: Ajay on June 12, 2015, 07:21:55 pm
Hi,
I am using PQGrid standard one.Now I have upgraded to PQGrid pro.

I have replaced the existing PqGrid.min.js with pro PQGRdi.min.js.
Now after upgrading I am not able to see the records.

In the picture below,there are 249 items,but it is showing as no records.

Here is my Code:
var columnModel = [{ title: nmc.platform.strings.Login, dataIndx: "nmsLogin", width: 150, align: "left"},
                               {title: nmc.platform.strings.LastName, dataIndx: "lastName", width: 130, align: "left"},
                               { title: nmc.platform.strings.FirstName, dataIndx: "firstName", width: 130, align: "left"},
                               { title: nmc.platform.strings.LastLogin, dataIndx: "lastLogin", width: 130, align: "left"},
                               { title: nmc.platform.strings.DaysLastLogin, dataIndx: "lastLogin", width: 150, align: "left"},
                               { title: nmc.platform.strings.TotalLoginCount, dataIndx: "loginCount", width: 150, align: "left" } ];

 searchLicenseUsageGrid.pqGrid({
                width: NMCApp.getSearchGridWidth(),
                height: NMCApp.getSearchGridHeight(),
                editable: false,
                topVisible: false,
                bottomVisible: false,
                numberCell: false,
                roundCorners: false,
                wrap: false,
                colModel: columnModel,
                dataModel: { data: [] },
                scrollModel: { pace: 'consistent', horizontal: true }
});

function searchLicensedUsers() {
        $.ajax({
            type: 'GET',
            url: searchLicenseUsageUrl + '&skip=' + startIndex,
            contentType: 'application/json; charset=utf-8',
            dataType: 'json',
            processdata: false,
            cache: false,
            success: function (data, textStatus, request) {
                for (var i = 0; i < data.length; i++) {
                    licenseUsers.push(data);
                }
                if (data.length == NMCApp.getMaxSearchNumber() && NMCApp.isSearchCancelled() == false) {
                    searchLicenseUsageGrid.pqGrid("option", "dataModel", { data: licenseUsers });
                    model.numberOfLicenseUsers(licenseUsers.length);
                    startIndex = startIndex + NMCApp.getMaxSearchNumber();
                    searchLicensedUsers();
                }
                else {
                    searchLicenseUsageGrid.pqGrid("option", "dataModel", { data: licenseUsers });
                    if (licenseUsers.length > 0)
                        searchLicenseUsageGrid.pqGrid("setSelection", { rowIndx: 0 });
                    model.numberOfLicenseUsers(licenseUsers.length);
                    if (NMCApp.isSearchCancelled() == false) {
                        NMCApp.hideLoadingWindow();
                        model.numberOfLicenseUsers(licenseUsers.length);
                    }
                    else
                        model.numberOfLicenseUsers(licenseUsers.length + ' (cancelled)');
                }
            },
            error: function (request, status, error) {
                NMCApp.hideLoadingWindow();
                NMCApp.handleNMCException(request.responseText);
            }

        });
    }
Title: Re: PQGrid not loading data in grid.
Post by: paramvir on June 15, 2015, 02:09:12 pm
refreshDataAndView() should be called after manually assigning data to the grid.

http://paramquery.com/pro/tutorial#topic-refreshView

Code: [Select]
searchLicenseUsageGrid.pqGrid("option", "dataModel", { data: licenseUsers }).pqGrid( 'refreshDataAndView' )
Title: Re: PQGrid not loading data in grid.
Post by: Ajay on June 15, 2015, 04:51:58 pm
Thanks It worked.
Even  RefreshAndView also worked.