Can't get grid working at all

Answered (Verified) This post has 1 verified answer | 5 Replies | 3 Followers Thread's RSS feed.

Greg Pringle
Points 1,325
Replied On: Tue, Oct 13 2015 1:30 PM Reply

I have reduced my sample as far as I can.. I get a jacascript error in the console when I run it, and the grid appears with column headings but no data:

Exception was thrown at line 1864, column 2 in http://localhost:56929/Scripts/jquery-1.10.2.js

0x800a139e - JavaScript runtime error: Syntax error, unrecognized expression: unsupported pseudo: jqmData

@{

ViewBag.Title = "CSM Tax Report";

}

@using Infragistics.Web.Mvc

@using TrackerMvc.Models.ClientTrackerDataModel.Reports

@model IQueryable<FormsByClient>

<div>

<link href="@Url.Content("~/Content/themes/infragistics/infragistics.theme.css")" rel="stylesheet" />

<link href="@Url.Content("~/Content/structure/infragistics.css")" rel="stylesheet" />

@section scripts {

<script src="@Url.Content("~/igniteui/js/infragistics.core.js")">script>

<script src="@Url.Content("~/igniteui/js/infragistics.lob.js")">script>

<script src="~/igniteui/js/infragistics.loader.js" type="text/javascript">script>

<script type="text/javascript">

$.ig.loader({

scriptPath: '@Url.Content("~/igniteui/js/")',

cssPath: '@Url.Content("~/igniteui/css/")',

resources: "igGrid.Sorting"

});

script>

@(Html.Infragistics()

.Grid<FormsByClient>(Model)

.ID("Grid")

.Height("500px")

.Width("100%")

.AutoGenerateColumns(false)

.AutoGenerateLayouts(true)

.RenderCheckboxes(true)

.ResponseDataKey(null)

.Columns(column =>

{

column.For(x => x.FileCompID).HeaderText("File Comp ID").Width("35%");

column.For(x => x.FiledMethodId).HeaderText("Filed Method ID").Width("65%");

})

.DataSourceUrl(Url.Content("~/ct/FormsByClientJson/1/2015/C"))

.Render()

)

}

div>

private GridModel GridLoadOnDemandModel()

{

// Define the Categories layout

GridModel grid = new GridModel();

grid.AutoGenerateLayouts = true;

grid.AutoGenerateColumns = false;

grid.Width = "100%";

grid.PrimaryKey = "FileCompID";

grid.Columns.Add(new GridColumn() { HeaderText = "FileCompID", Key = "FileCompID", DataType = "number", Width = "15%" });

grid.Columns.Add(new GridColumn() { HeaderText = "FiledMethodId", Key = "FiledMethodId", DataType = "number", Width = "85%" });

return grid;

}

[Route("FormsByClientJson/{id:int}/{fileyear:int}/{filetype:alpha}")]

public JsonResult FormsByClientJson(int id, int fileyear, string filetype)

{

GridModel model = GridLoadOnDemandModel();

model.DataSource= new List<FormsByClient>()

{

new FormsByClient() { FileCompID = 1, FiledMethodId = 10 },

new FormsByClient() { FileCompID = 2, FiledMethodId = 20 }

}.AsQueryable();

return model.GetData();

}

namespace TrackerMvc.Models.ClientTrackerDataModel.Reports

{

public class FormsByClient

{

public int FileCompID { get; set; }

public int FiledMethodId { get; set; }

}

}

JSON Returned by Datasourceurl =

{"Records":[{"FileCompID":1,"FiledMethodId":10},{"FileCompID":2,"FiledMethodId":20}],"TotalRecordsCount":0,"Metadata":{"timezoneOffset":-21600000}}

  • Post Points: 35

Verified Answer

Greg Pringle
Points 1,325
Answered (Verified) Replied On: Mon, Oct 19 2015 6:30 PM Reply
Verified by Greg Pringle

Nevermind.. the offending line was this:

.ResponseDataKey(null)

Started working after I removed it.  I copied it from an example and (mistakenly) thought it meant it would default to default value instead of null.

  • Post Points: 20

All Replies

[Infragistics]DeyanK
Points 3,595
Infragistics Employee
Replied On: Thu, Oct 15 2015 7:41 AM Reply

Hello Greg Pringle,

Thank you for posting into our community!

Using loader

$.ig.loader({

scriptPath: '@Url.Content("~/igniteui/js/")',

cssPath: '@Url.Content("~/igniteui/css/")',

resources: "igGrid.Sorting"

});

and the scripts

<script src="@Url.Content("~/igniteui/js/infragistics.core.js")">script>

<script src="@Url.Content("~/igniteui/js/infragistics.lob.js")">script>

at the same time is not recommended since you are referring the same scripts twice

I didn't manage to find the action of your controller. Can you send the reduced sample or inform us how does your action in the controller look like.

Regards,
Deyan Kamburov,
Software Developer,
Infragistics

  • Post Points: 20
Greg Pringle
Points 1,325
Replied On: Mon, Oct 19 2015 5:58 PM Reply

Deyan,

Thank you for your suggestions.

If I comment out the loader I get the same behavior.
If I comment out the two script lines you mention I get this error:

Unhandled exception at line 77, column 47 in http://localhost:56929/Ct/CsmTaxReport
0x800a01b6 - JavaScript runtime error: Object doesn't support property or method 'igGrid'

Does it matter what the controller looks like if I go to the url specified in the .DataSourceUrl and it returns the Json I included?

I included it above but here it is again:

private GridModel GridLoadOnDemandModel()

{

// Define the Categories layout

GridModel grid = new GridModel();

grid.AutoGenerateLayouts = true;

grid.AutoGenerateColumns = false;

grid.Width = "100%";

grid.PrimaryKey = "FileCompID";

grid.Columns.Add(new GridColumn() { HeaderText = "FileCompID", Key = "FileCompID", DataType = "number", Width = "15%" });

grid.Columns.Add(new GridColumn() { HeaderText = "FiledMethodId", Key = "FiledMethodId", DataType = "number", Width = "85%" });

return grid;

}

[Route("FormsByClientJson/{id:int}/{fileyear:int}/{filetype:alpha}")]

public JsonResult FormsByClientJson(int id, int fileyear, string filetype)

{

GridModel model = GridLoadOnDemandModel();

model.DataSource= new List<FormsByClient>()

{

new FormsByClient() { FileCompID = 1, FiledMethodId = 10 },

new FormsByClient() { FileCompID = 2, FiledMethodId = 20 }

}.AsQueryable();

return model.GetData();

}

  • Post Points: 5
Greg Pringle
Points 1,325
Answered (Verified) Replied On: Mon, Oct 19 2015 6:30 PM Reply
Verified by Greg Pringle

Nevermind.. the offending line was this:

.ResponseDataKey(null)

Started working after I removed it.  I copied it from an example and (mistakenly) thought it meant it would default to default value instead of null.

  • Post Points: 20
[Infragistics]DeyanK
Points 3,595
Infragistics Employee
Replied On: Thu, Oct 22 2015 3:32 AM Reply

I'm glad to see that you found the solution and post it to our community. If you have any other questions regarding this matter, please let us know.

Regards,
Deyan Kamburov,
Software Developer,
Infragistics

  • Post Points: 5
Page 1 of 1 (6 items) | RSS