I am using the Jquery grid with knockout and MVC 3 and am getting a "Function Expected" error when the extensions/infragistics.ui.grid.knockout-extensions.js file loads. The error breaks right at this line of script in the file: "ko.bindingHandlers.igCell={init:function(c,e,a,f,b){}..."
I am using igLoader as follows:
<script type="text/javascript" src="@Url.Content("~/scripts/infragistics.loader.js")"></script>
<script type="text/javascript">
$.ig.loader({
scriptPath: "@Url.Content("~/scripts")",
cssPath: "@Url.Content("~/content")",
resources: "igGrid.*,extensions/infragistics.datasource.knockoutjs.js,extensions/infragistics.ui.grid.knockout-extensions.js"
});
</script>
I have copied the GridKnockoutjsBasic.html and GridKnockoutjsBasicController from the Infragistics samples into my app and the Northwind files (db and js) and ran it....the text boxes all fill in with the first row data just like in the grid knockout sample however the grid does not display. I had to remove the "extensions/infragistics.ui.grid.knockout-extensions.js" part from the igLoader:
scriptPath: "/Scripts/",
cssPath: "/Content/",
or else I get the "function expected" error. Not sure if removing this is what causes the grid to not show up but if I leave it in I get the error and if I ignore it, the grid still does not display.
Hi,
Unfortunately I was unable to reproduce your problem. Attached you can find my samples for both 12.1 RTM(build 1010) and 12.1 SR(build 2023). Please review them and see if they can help you resolve your problem.
Because KnockoutJS is client side solution I exclude that the reason can be in the MVC 3 framework.
The file infragistics.ui.grid.knockout-extensions.js is where the grid instantiation happens and removing it will not try to create the grid at all. In the infragistics.datasource.knockoutjs.js is located the data source object which is responsible for communication with the KnockoutJS. Both these files play major role in KnockoutJS integration.
Note: Apart from having "Knockout JavaScript library" included in the sample you also need "Knockout Mapping plugin" which you can find in my samples as (knockout-latest.debug.js and knockout.mapping-latest.debug.js respectively).
I suspect that the cause of the problem is somewhere in the view model.
Can you attach the sample which reproduces the problem so I can investigate it?
Hope this helps,
Martin Pavlov
Infragistics, Inc.
Sorry about hijacking this thread, but I've been having similar issues so I decided to try this example. I can get my model to work using this code, but it is very slow. Even using the code as is, the grid takes about 2 seconds to render after the first part of the page is rendered. I even changed the infragistics script to load locally. Is the Knockout integration that much slower than a native Infragistics grid? I'm worried that with just 10 rows and 4 columns rendering this slow, how long will it take for 100 rows with 30 cols?
-Shane
Hi Shane,
I revised my sample and there are two things which make it slow.
First I use Infragistics CDN (because sample can be run out of the box). I would say that the CDN is not very fast (at least from my location).
The second reason is that in the loader I enabled all the igGrid features.
After I changed the loader to use local files and enabled only igGridUpdating everything run for about 800ms and the original sample run for about 2 seconds (see attached screenshot).
Using KnockoutJS integration adds some overhead to the grid, but after analyzing it with Chrome Developer Tools Timeline I consider it as very small.
Martin,
Thanks for the update. I really like what the Knockout integration gives us and I'm glad to see it's not a huge drain on performance.
Definitely something up with the trial. When I downloaded the CDN version of the knockout-extensions.js I was able to run my project without errors. Otherwise the the console kept complaining "object not a function" with the download trial version of the library.
Just FYI hope that helps others.
You can download the correct version here until the guys get it sorted out.
http://origin1tech.wordpress.com/2012/07/30/knockoutjs-and-ifragistics-jquery-iggrid/
The sample that was posted did work for me...it does use CDN's for the Infragistics scripts....sould be interesting to see if it still worked with the scripts referenced locally. I am good for now though....thanks for all our help.
Hello,
I am just to see if you if you need any further assistance with this matter.