Hi,
I would like to have a column in the grid which contains a hyperlink, but I could not find documentation for mvc3. My grid is defined like this:
<%: Html.Infragistics().Grid<CourtRecordsModule.ViewModels.CourtRecord>()
.ID("gridMainDocument")
.DataSourceUrl(Url.Action("GetMainDocument", "EditRecord", new { id = Model.DomainModelCourtRecord.MainRecordID }))
.AutoCommit(true)
.Columns(c =>
{
c.For(x => x.DomainModelCourtRecord.Title).DataType("string").HeaderText("Title").Width("400px");
c.For(x => x.DomainModelCourtRecord.LanguageName).DataType("string").HeaderText("Language *").Width("150px");
c.For(x => x.DomainModelCourtRecord.ConfidentialityDesc).DataType("string").HeaderText("Confidentiality *").Width("150px");
c.For(x => x.DomainModelCourtRecord.ExParteWho).DataType("string").HeaderText("Ex Parte to who").Width("200px");
})
.DataBind().Render() %>
Any help is appreciated..
Hi IccAppSupport,
In 12.1 release we introduced new igGrid feature called "Column template". Here is topic on the subject: http://help.infragistics.com/NetAdvantage/jQuery/2012.1/CLR4.0?page=Creating a Basic Column Template in the igGrid.html
Here is example code:
Notice the Template method in which you set the column template.
Here you can see sample for column template(in the code view you can find the MVC code):
http://samples.infragistics.com/jquery/grid/basic-column-template
If you're using 11.2 you have to define row template. Here is sample(in the code view you can find the MVC code):
http://samples.infragistics.com/jquery/grid/row-template
Hope this helps.
Martin Pavlov,
Infragistics, Inc.
Hi Martin,
Thank you for your fast reply, indeed I'm using Netadvantage 12.1 release. I have created the template column this way:
.Columns(c => {
c.For(x => x.Link).Template("<a href='http://google.com'>View</a>").HeaderText(" ").Width("100px");
and I expected that "View" is the hyperlink, however the "View" text is not present in the new column.
Did I forgot to include any library or javascript file from service release 12.1? (I recently migrated from 11.2 to 12.1 and I have just replaced the dll's).
Your code looks fine. However upgrading to 12.1 from 11.2 is not a trivial process.
You should read this topic: http://help.infragistics.com/NetAdvantage/jQuery/2012.1/CLR4.0?page=Manually_Updating_Previous_Versions.html in order to upgrade.
In 12.1 we introduced Infragistics loader control. It loads the necessary files for a control so you don't have to keep thinking for this. Also we've made file name restructuring so now you have infragistics.js instead of ig.ui.js for example. This is something that you should take care too.
So in 12.1 you've to choose from 2 methods of referencing controls. One is by using Infragistics loader and other is by manually referencing JavaScript files. The recommended way is to use Infragistics loader.
Here: http://help.infragistics.com/NetAdvantage/jQuery/2012.1/CLR4.0?page=Using_Infragistics_Loader.html you can find information for Infragistics loader.
And here: http://help.infragistics.com/NetAdvantage/jQuery/2012.1/CLR4.0?page=Deployment_Guide_JavaScript_Files.html you can find the required files for a control if you want to manually reference the controls.
After all this talking the simplest thing to do is to replace ig.ui.min.js with infragistics.js and see if it works. Keep in mind that infragistics.js is big file (more than 2Mb) and contains all the controls, so it is not advisable to use it in production when you're using just grid functionality.
If you still face problems you can attach sample for me to investigate.
Hope this helps,
Martin Pavlov
I am trying to use the Infragistics loader control (and to figure out the changes from the service release 2012.1). In my Site.Master page I have added:
<script src="<%: Url.Content("~/Scripts/Infragistics/js/infragistics.loader.js") %>" type="text/javascript"></script>
and in my aspx page I have added the loader:
<%=Html.Infragistics().Loader()
.ScriptPath(Url.Content("~/Scripts/Infragistics/js/"))
.CssPath(Url.Content("~/Content/Infragistics/css/")) .Render() %>
On the aspx page I have a datepicker element defined as:
<%= Html.Infragistics().DatePickerFor(model => model.DomainModelCourtRecord.Creation)
.ID("Creation")....Render() %>,
and I get an error "Uncaught TypeError: Object [object Object] has no method 'igEditor'" in the infragistics.loader.js.
If I try to add it as a resource like this:
<%= Html.Infragistics().Loader()
.CssPath(Url.Content("~/Content/Infragistics/css/"))
.Resources("igEditor")
.Render()
%> I get the error: Uncaught Resource 'igEditor' cannot be found. Please check that the resource name is correct.
How should I proceed loading the DatePicker (if possible using MVC wrappers and not javascript)?
Your code looks correct. One thing to note is that in MVC you don't need to use Resources method if you use MVC initialization of the Infragistics controls. They will generate the desired Resources code when they are rendered. Other point is that for Infragistics editors the resources constant is "igEditors" and not "igEditor".
My best guess about the error is that editors file is not loaded so the type "igEditor" is not available. Did you check the browser error console for missing file?
You can try to work it out with Infragistics CDN. Here is the code which you need to put in your view:
1 Add reference to Infragistics loader
<script src="http://cdn-na.infragistics.com/jquery/20121/1010/js/infragistics.loader.js"></script>
2 Initialize loader in MVC
@(Html.Infragistics().Loader().ScriptPath("http://cdn-na.infragistics.com/jquery/20121/1010/js/").CssPath("http://cdn-na.infragistics.com/jquery/20121/1010/css/").Render())
3 Initialize DatePicker (you should put your DatePicker initialization here. I tested it with this one.)
@(Html.Infragistics().DatePicker("myDatePicker").Render())
If this works, then you have missing files in "~/Scripts/Infragistics/js/modules" folder.
If this doesn't help then can you attach your View for me to investigate? I'm also interested in the generated HTML from your view.
DatePicker should be included in jquery-ui.min.js. Maybe you're using custom build of the framework.
However I'm glad that you work out your problem.
Good luck with you application.
Best Regards,
Sorry it was my mistake I didn't read the "known issues" section for 2012.1. It seems for the DatePicker control I needed to load the library jquery.ui.datepicker.js. So everything is oki after I loaded the following dependent libraries, in this order:
<script src="<%: Url.Content("~/Scripts/jquery-1.7.2.min.js") %>" type="text/javascript"></script>
<script src="<%: Url.Content("~/Scripts/jquery-ui.min.js") %>" type="text/javascript"></script>
<script src="<%: Url.Content("~/Scripts/jquery.ui.core.js") %>" type="text/javascript"></script>
<script src="<%: Url.Content("~/Scripts/jquery.ui.widget.js") %>" type="text/javascript"></script>
<script src="<%: Url.Content("~/Scripts/jquery.ui.datepicker.js") %>" type="text/javascript"></script>
Thanks a lot for your time. Btw now the column with the hyperlink works too.
Kind regards,