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
615
MVC Loader() - Combo and Grid on the same page
posted

Hello support team,

I have a situation where I'm displaying a page with several search options.  One of them is an igcombo.  When this page loads, I call Loader() to bring in all of the necessary files for the igcombo.

Once the user submits the search form, an ajax call is made, and a partial view is rendered with the results in an iggrid.  In the partial view, I also call Loader() so that it can bring in the files necessary for the iggrid.

However, when the grid loads, I get a javascript error: Line: 28
Error: Unable to get property '_injectGrid' of undefined or null reference

If I don't use the igcombo in the initial page load, this error won't occur.  Is there some way I can tell the loader that I need both the combo and the grid files, even though when the page first loads there is no grid to display?

Edit: I've been playing a little more with the editable feature of the grid, and I've come across another problem related to the loader:

http://www.igniteui.com/grid/basic-editing

When my grid loads, I get an error message: Object doesn't support property or method 'igButton' (I copied the html for the 'Save Changes' and 'Undo' buttons from the sample).

My code is a little different than the sample.  The sample uses the jQuery document.ready shortcut to assign all of the handlers.  I can't do that because I'm loading the grid inside of a partial view, so I wrapped all of that sample code in a function called applyEditable() and then called that function in the OnSuccess method of my ajax call which renders the grid.

When I check the page in the browser's debugger, the Loader() method doesn't seem to be loading the lob javascript file, which I believe contains the definition of igButton (if I'm reading the sample correctly).

So, now I'm a little more confused about how to use the loader.  I'm calling the Loader once when the search options view renders, and then once again in the view that renders the grid.  In each case, the loader is at the top of the file, before any html is rendered.  Am I doing something wrong?

Thank you very much!  These are fun controls - I just feel like my inexperience with web development gets in my way sometimes.

Parents Reply Children