0

This was working with no problems yesterday. However, I'm unable to identify any obvious changes in my code since leaving and returning to my workstation this morning.

I have an ASP.NET MVC 5 controller method which returns a JsonAction object, and accepts no parameters (HttpGet). I've tested its return, and it is returning proper JSON--the same structure as with yesterday when I didn't have this issue. This does seem to rule out any possibilities on the server-side.

The call to dataBind is using a URL which looks like this:

/Home/GetAllUsersJSON?pk=userid&_=1413996086894

The cause appears to be, from examining in Chrome, that the igGrid's client API seems to be appending (or attempting to append) a query string to the end of the dataSourceURL during dataBind(). I can't even identify the value of the second parameter (which also is nameless, seemingly just an underscore character) in any of the relevant database tables (in other words, I haven't a clue where that value comes from)--however, it does remain unchanged through each debug attempt.

I'm only using client-side (JS) to render and operate the igGrid. Here is that code:

$(document).ready(function () {
    $('#usersgrid').igGrid({
        autoGenerateColumns: false,
        columns:    [
            { headerText: 'userid', key: 'userid', dataType: 'number' },
            { headerText: 'username', key: 'username', dataType: 'string' },
            { headerText: 'login', key: 'loginid', dataType: 'string' },
            { headerText: 'role', key: 'role', dataType: 'string' },
            { headerText: 'distributor', key: 'distributorid', dataType: 'number' },
            { headerText: 'inactive', key: 'inactive', dataType: 'boolean' },
            { headerText: 'lastupdated', key: 'lastupdated', dataType: 'date', format: 'dateTime' }
        ],
        dataSourceUrl: '/Home/GetAllUsersJSON',
        primaryKey: 'userid',
        features: [{
            name: 'Updating',
            enableAddRow: true,
            enableDeleteRow: true,
            columnSettings: [{
                columnKey: 'userid',
                editorOptions: { readonly: true, disabled: true }
            }, {
                columnKey: 'username',
                editorType: 'string',
                validation: true,
                editorOptions: { required: true }
            }, {
                columnKey: 'loginid',
                editorOptions: { readonly: true, disabled: true }
            }, {
                columnKey: 'role',
                editorType: 'string',
                validation: true,
                editorOptions: { required: true }
            }, {
                columnKey: 'distributorid',
                editorType: 'numeric',
                validation: true,
                editorOptions: { button: 'spin', minValue: 0, maxValue: 2000000, required: true }
            }, {
                columnKey: 'inactive',
                editorType: 'combo',
                editorOptions: {
                    mode: 'dropdown',
                    required: true,
                    dataSource: trueFalseValues,
                    textKey: 'text',
                    valueKey: 'value'
                }
            }, {
                columnKey: 'lastupdated',
                editorOptions: { readonly: true, disabled: true }
            }]
        } ]
    }).igGrid('dataBind');
});
Konstantin Dinev
  • 34,219
  • 14
  • 75
  • 100

1 Answers1

0

Use the dataSource option instead of the dataSourceUrl. The dataSourceUrl is intended for load on demand scenarios in MVC and is not used for initial data binding. You can pass a remote url as the dataSource option value. The parameters that you see are the name of the primary key field and the callback to be executed when the jsonp request finishes.

Konstantin Dinev
  • 34,219
  • 14
  • 75
  • 100
  • Please have a look at http://stackoverflow.com/questions/28434621/using-my-custom-ajax-call-for-load-on-demand-on-ighierarchical-grid – Vivek Vardhan Feb 11 '15 at 05:40