Hi Friends,
As per the our requirement we required to provide the hyperlink in some of the grid columns, the grid columns shall not be static and it shall be loaded dynamically from the database.
We can able to bind the grid by enabling the autoGenerateColumns: true option. but we could not able to format/set the hyperlink in the Grid columns.
please help us to proceed this issue further.
Also please suggest is it possible to apply the template for the column after binding the grid data? since by clicking the hyperlink we required to show the popup window based on the corresponding cell value.
The below code sample is for your reference.
Function BindStudyGrid(gridID, gridData) {
$("#" + gridID).igGrid({ primaryKey: "StudyId", autoGenerateColumns: true, width: "100%", height: "350px", columns: [ { headerText: "ID", key: "StudyId", dataType: "number", width: "0px" } ], fixedHeaders: true, autofitLastColumn: false, features: [ { name: "Paging" }, { name: "Filtering" }, { name: "Sorting" } ], enableHoverStyles: true, dataSource: gridData }); }
if any more information is required from us, please let us know.
Hello Satkhi,
Columns with datatype: "date" should not be autogenerated and rather than that should be defined separately when you want to apply them custom format. In case that date values are formatted appropriately still in the datasource and not represented as string values, you may handle dataRendering event and set the desired date format like for instance:
dataRendering: function(evt, ui) { ui.owner.options.columns[5].format = "YYYY/MM/DD"; },
Please note that this approach may hide risks for data dependant features like filtering feature to not work properly. Therefore for cleaner approach I would suggest you to define your date column separately and apply it your custom format, like for instance: { headerText: "Register Date", key: "RegistererDate", dataType: "date", format: "YYYY/MM/DD" }
If you have further questions, feel free to ask.
Regards,Tsanna
Hi Friends
We are using infragistics 16.2 version and we are facing the problem on formatting the grid "DATE" column while binding the data dynamically. you can see in our previous code we have given as autoGenerateColumns: true, now we have to apply the column format after bind the data into GRID.
As per the requirement, we have to show the date column with the following format "YYYY/MM/DD", but we could not able to format/apply the data type to the column.
Please help us to proceed further. if required any more information please let us know.
Code to Bind the Grid data
As per the scenario we have to format the grid the DATE column after bind the grid data.
Which version of our product you're currently using? Please note that since v17.1 the Microsoft format of dates is no longer supported in the grid, for example: /Date(1234656000000)/. If the provided data source contains this kind of data they have to be changed to ISO UTC format "2009-02-15T00:00:00Z". Regarding the grid format applied to the date column, please use format option: https://www.igniteui.com/help/api/2016.2/ui.iggrid#options:columns.format in order to apply the desired format.
If I can help you with something else, feel free to contact me.
Regards,
Tsanna
Thank you for posting in our community.
In order to apply a column template after initialization the rendered event can be handled. In this event the template can be created and assigned to the template option of a particular column. This event is fired after the whole grid widget has been rendered. For example:
$(document).delegate("#grid", "iggridrendered", function (evt, ui) { var col = $("#grid").igGrid("option", "columns")[2], tmpl = "<a href='http://infragistics.com'>${LastName}</a>"; col.template = tmpl; })
After the new template is set the dataBind method should be called in order to apply the changes.
I am attaching a small sample illustrating my suggestion for your reference. Please test it on your side and let me know whether it helps you achieve your requirement.