Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1415
Can't get grid working at all
posted

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}}

Parents
  • 3995
    Offline posted

    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.

Reply
  • 1415
    Offline posted in reply to Deyan Kamburov

    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();

    }

Children