I really need some help here.
I'm using MVC3 with Visual Studio 2010. with jquery 1.6.2 AND jquery-ui 1.8.14.
I have a jQuery grid on a view that will not show data even though I've verified that I'm getting data back from the database.
The grid is set up very simply (no features). It's using a datasourceURL to retrieve the data and the corresponding action is getting. When I return the view, I've tried passing in the ObjectResult (no data displayed, no errors). I've tried passing in an IQueryable, but this gives me an error in the javascript (1.6.2) that says "Microsoft JScript runtime error: The remote request to fetch data has failed: (error) undefined". This error is thrown at the point where I'm returning the view for the grid request.
If I set up a grid with the exact same parameters, but use the columns set in the demo project "Taz" created, and even use the same dataSourceURL, but change the returned data to be the auto-generated 1000 records of accounts, it works fine.
What am I missing?
Thanks,
Tony
Sorry, I was trapped in meetings all yesterday afternoon.
This morning I put together an example, got it working, then added a relationship to the database and regenerated the EF model. Now I'm getting the error again.
This is a SUPER-SIMPLE application with one controller, one model, one view.
-- Well, I tried to attach it, but the MAX size is 200KB
With a database, and the script/content files, there's no way to attach it.
OK,
Here you go.
You can find it here: https://skydrive.live.com/redir.aspx?cid=169b462c35ba461a&resid=169B462C35BA461A!294&authkey=WmU3Z0g0!kw%24
Once you confirm you have it I'll remove it from public access.
Hi Tony,
I have downloaded your sample (so you can safely remove it now), i took a look at the code, everything looks really simple and correct, but maybe the problem is in this line:
column.For(x => x.AccountNumber).DataType("int")
DataType should be either "string", "date", "number" or "bool". I suggest to change the above to "number".
I won't get a chance to run the sample until tomorrow, but in the meantime you can try to above suggestion. I'll let you know additionally, if that doesn't help.
By the way there is no need to explicitly specify a DataType for the columns, because when the grid is configured in the view, the grid MVC code automatically determines the DataType.
Thank you,
Angel
Just to clarify, this data type is not the underlying .NET type for the model's property. It's rather the data type that will be expected on the client-side, so since JavaScript doesn't have a notion of types (in this case of a float / double, "number" is used for any of these. To add more to this, if your .NET model's property type is string, but you still want this to be converted to a number, this can be done by the grid directly on the client-side, if the DataType is specifically set to a "number". This is basically handled when the data source is bound on the client, and data is transformed according to the column shema defined.
Hope it helps,
Well, I tried setting them all to string, then ended up removing the .DataType specifier alltogether, but I'm still getting the same error.
By the way, in this test project, the error comes up in ig.ui.min.js
In my production app, it's in a jquery file. It's the same exception though.