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: 28Error: 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.
Hello Kyle,
Thank you for posting in our community!
We received your support request concerning using igGrid with igCombo at the same page, and this case has been assigned to me. I have attached two samples representing how igGrid and igCombo could be implemented in the same page. The first sample uses the loader and the second sample is an MVC and uses the MVC wrapper.
Hope this helps. If you have any additional question feel free to update the case. In order to investigate further I will need a sample reproducing the issue you have encountered.
Looking forwards to your reply.
The MVC sample.
Thanks Dimka,
I'm trying some of the ideas in your sample to see if they will help me. I'll let you know how it goes.
The tricky part is that in my application, the grid is not immediately rendered on the page. It is only rendered after the user enters some search options and submits a search form. Also, to clarify, my grid does not contain an igcombo - the igcombo is used before the grid is rendered to assist the user with entering a search term.
My approach so far has been to call Loader() when the page first loads (to load the igcombo), and then call Loader() again in the partial view which renders the grid. That approach hasn't been working for me, so perhaps I will try the idea of explicitly using the .Resources() option of the Loader() method.
I may try to work up a sample for you if I have time, but I may take a couple of days.
Thanks!
Hi Dimka,
I think this will be easier if I show you a small sample of the files I'm working with. I made a new MVC5 project and set up a simple page that will use an ajax call to display an editable grid. The zipped project size was about 25MB, so I've just attached the important files. I can provide more if you need them. If you just plug these files into a new MVC5 project with all of the infragistics scripts, I think it should work (it also requires Microsoft Unobtrusive AJAX, which I don't think comes preinstalled for MVC5).
Anyway, what's happening now is that when I try to load the partial view which displays the grid, it's telling me that it can't figure out what an igButton is. In this case there is no igcombo getting in the way - it's just a simple ajax call that displays a grid.
If you have a chance to take a look at this, I would really appreciate it. Let me know if anything I did was confusing, or if there are any other files I can provide for you. Thanks!
I am just following up what your progress is on this scenario. If you need any further assistance please let me know.
Thanks Dimka! I will try these changes as soon as I can and let you know how it works.
I have managed to investigate this further. I have made several modifications:
The model is referred both in Index.cshtml and _GridPartial.cshtml
The scripts re loaded in the Index.cshtml page by the following code snippet:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/jquery-ui.min.js" type="text/javascript"></script>
<script src="http://cdn-na.infragistics.com/jquery/20131/latest/js/infragistics.loader.js"></script>
@(Html.Infragistics().Loader()
.ScriptPath("http://cdn-na.infragistics.com/jquery/20131/latest/js/")
.CssPath("http://cdn-na.infragistics.com/jquery/20131/latest/css/")
.Resources("igHierarchicalGrid.*")
.Render()
)
Attached is the modified version of the sample for your reference.
If any further questions arise feel free to contact me again.
I removed the folders, and now it's only about 6MB, so I'll just try to upload it here.
Thanks again!
Thank you for your answer.
I have tried to reproduce the issue but since I have encountered other issues would you send me the whole package? In order to decrease the size please remove the packages folder, the bin and the obj folders. You might to use the following email to upload it: support@infragistics.com
Please add my name in the subject field if you decide to use the email.
Thank you in advance.
Looking forwards to hearing from you.