Hi,
I'm using Infragistics 12.1 jQuery controls and cannot for the life of me set the value of a igHtmlEditor. The Infragistics documentation is poor at best as I've worked with 4 or 5 jQuery 12.1 controls and next to nothing works as expected (in terms of the API). For example, your samples/examples say to use $(element).igDatePicker("value") to get the value of a date picker when actually, you have to use $(element).igEditor("value"). What gives? I've had to hit up the forums or google to figure out how to use each one of those jQuery controls because the documentation is incorrect!
Now that I've vented a little, let me get to the problem at hand. I've tried setting the Value on the HtmlEditorModel which does not work. I tried setting the value in javascript using $(element).igHtmlEditor("setContent", "<p>this is my content</p>", "html"); which also does not work. Furthermore, when I use the latter method, the control fails to render. I can see that there is a new ig.loader script added to the page with my content specified, but the HtmlEditor is no where to be found.
How can I set the value? I would prefer to define it at the same I define the control (ASPX/MVC Helper Method). However, with the ASPX method for adding a control, I have to use Html.Infragistics().HtmlEditor("myID", myHtmlEditorModel) which doesn't allow you add Value() to the chain. Sigh.
Please help.
Here's my igLoader Javascript implementation:
<script type="text/javascript" src="/Scripts/jquery-ui.min.js"></script> <script type="text/javascript" src="/Scripts/Infragistics/jQuery/infragistics.js"></script> <script type="text/javascript" src="/Scripts/Infragistics/jQuery/infragistics.loader.js"></script> <script type="text/javascript">$.ig.loader({ scriptPath: "/Scripts/Infragistics/jQuery/", cssPath: "/Styles/Infragistics/jQuery/", theme: "metro", resources: "igShared,igCombo" });</script> <link type="text/css" href="/Styles/Infragistics/jQuery/metro/infragistics.theme.css" rel="stylesheet" /> <link type="text/css" href="/Styles/Infragistics/jQuery/structure/infragistics.css" rel="stylesheet" />
Hey Steve,
I'll go ahead and save you some time by telling you it appears to be a bug. I tried everything including creating an igHtmlEditorModel and setting the value on that. Still no dice.
Are you using the MVC helper to instantiate your igLoader too?
The only solution I found was to switch the igLoader to the javascript version. You can still leave your MVC instantiated igHtmlEditor as is, and it should work.
Best of luck,
Andrew
I'm having the same issue and am interested in a clarification. The MVC Html helper syntax works fine for me with the evident exception of Value. If I specify InputName("text1"), for example, the control is rendered with name="text1" as expected. Specifying Value("This is a test"), however, results in a blank control and empty <textarea>. Is there a valid reason for this or is it a bug?
I don't particularly want to switch to the Javascript method to make this work properly. Is there any reason this code shouldn't work?
@(Html. Infragistics(). HtmlEditor(). ID("editor1"). Value("This is a test"). InputName("editor1"). Render() )
If not, what is the purpose of Value in the MVC syntax?
Thanks in advance,
Steve
Thank you for your help Alex, but your example is not set up at all how I described.
To reiterate, I was initializing igLoader AND igHtmlEditor using theMVC/ASP.NET Helper(notcreating/initializing them using the javascript method). I was then using the javascript methods to manipulate the controls client-side. Try that and you should be able to replicate the bug.
Anyways, I was finally able to figure it out on my own as a side effect of something else I was doing. I ended up switching to initializing igLoader using the Javascript method (notthe MVC/ASP.Net Helper method) and now I can populate the igHtmlEditor. Even though I'm still creating the igHtmlEditor using the MVC helper method, it really just needs the igLoader to be initialized using the Javascript method.
You may want to update the grossly inaccurate documentation as there are still many discrepancies in the samples and documentation as I outlined in my original post. It also is inaccurate in that you can't simply choose which method you would like to use when initializing the igLoader (MVC vs Javascript) because as we just learned, some controls such as the igHtmlEditor, can't be populated unless you're initializing the igLoader using the Javascript method.
Thanks for your time Alex and hopefully you can get this issue resolved.
Hello abromfield,
I have created sample that uses IG loader and two HTML editors and I have used “setContent” method to set HTML content in both editors.
In this sample the functionality is working as expected.
I am attaching it for your reference – just add your js and css files in the ig directory and you should be able to run it.
Test it and let me know what the results are.