Hello, I would like to know who to add a link in a column with igHierarchicalGrid.
Can I add a parameter at the creation of the column ?
like :
{ headerText: "CLIENT", key: "nom", width: "150px", dataType: "string", link : "http://www.google.fr"},
Here my code :
$(window).load(function () {; $("#grid1").igGrid({ features: [ {name: "Paging",type: "local",pageSize: 10}, {name: "Sorting",type: "local"}, {name: "Filtering",type: "local"}, {name: "Resizing",allowDoubleClickToResize: true}, ], autoGenerateColumns: false, dataSource: 'popup_1.php?ind=<?php echo $_GET['ind']; ?>&pop=07', responseDataKey: 'records', initialDataBindDepth: -1, height: 500, width : 950, columns: [ { headerText: "CLIENT", key: "nom", width: "150px", dataType: "string"}, { headerText: "NB SOC", key: "nb_societes", width: "50px", dataType: "string" }, { headerText: "SD", key: "sd_validation", width: "50px", dataType: "string" }, { headerText: "SEGMENT", key: "entite_co_validation", width: "100px", dataType: "string" }, { headerText: "CONSEILLER", key: "co_validation", width: "150px", dataType: "string" }, { headerText: "ENTITE CLIENTELE", key: "entite_rc_validation", width: "100px", dataType: "string" }, { headerText: "RC", key: "rc_validation", width: "150px", dataType: "string" }, { headerText: "ENTITE", key: "rc_validation", width: "150px", dataType: "string" } ] }); });
I receive my dataSource from a php page, it's an array with json_encode().
Thanks for helping !
ps : sorry for my English, I'm Frensh
I found the solution :
jQueryTemplating: true, rowTemplate: "<tr>" + "<td> <a href=\"BLOCKED SCRIPTwindow.parent.location='../vision/index.php?idcli=${id}'\"; >${nom}</a></td> " + "<td> ${nb_societes}</td>" + "<td> ${sd_validation} </td>" + "<td> ${sm_validation} </td>" + "<td> ${entite_co_validation} </td>" + "<td> ${co_validation} </td>" + "<td> ${entite_rc_validation} </td>" + "<td> ${rc_validation} </td>" + "</tr>",
Hi Stef,I'm glad to see you were able to use the row template to place the link inside the column.Just a tip: You can search the forums before posting a new question - it might just be the quickest way to find the answer you're looking for :).For example using the search in the igGrid forums at http://es.infragistics.com/community/forums/499.aspx with the term "link" immediately brings up two very relevant results:link in a columnhyperlink column in gridFinally, I can also recommend the cell template which you can use as an alternative to the row template - it will allow you to define the template as just:"<a href=\"BLOCKED SCRIPTwindow.parent.location='../vision/index.php?idcli=${id}'\"; >${nom}</a>"for the nom column.A full description of this option is available under the columns > template API reference for the igGrid. (I'm also attaching a screenshot of the exact explanation to my current reply)PS: All grids in the igHierarchicalGrid, no matter if root or children, are flat igGrids, so the igGrid help resource apply for all of them. Cheers,Borislav
Hello, I have a question, yet;) Is what I can put AutoGenerateColumns: true and add a template to my columns. Currently it does not work. I set AutoGenerateColumns: true because if I empty values column is deleted. Thank you for your help. Stef.
Hi Stef,
Please excuse me about the delay in my reply.I've attached an HTML sample demonstrating an igGrid with autoGenerateColumns and a row template which works.As you can see, you still need to point out the column's keys in the template - it's not possible to use column indices in such a situation I'm afraid.
I see the problem you've mentioned: when all of the values for a column are NULL, that column isn't displayed.(Note that this only happens when a row template is used).
I'll log this issue to our developers so it can hopefully be fixed for the next Service Release.
While you wait, I can recommend a workaround you can try while you wait: if possible, replace the NULLs with empty strings - that will be enough for the data binding to be successful.
Hope this helps,Borislav
Hello Stef,
I have created a support ticket on your behalf with number CAS-98159-C5F8V9. This case is linked with development issue # 118936 – “When autoGenerateColumns = TRUE and a row template is used, a column that contains only NULLs isn't displayed correctly”.
You can view its status by going to “Account > My Support Activity” on our website, selecting your case and clicking the "Development Issues" tab.
If you need more information, please feel free to contact us.
Hi Nikolay, hi Borislav,
Thank you for your reply.
I really do not understand why RowTemplate with condition not working, I get an error invalid property id js var $ = jQuery, call, _ = [], $ data = $ item.dat ...);} _.push ('</ a> </ td> </ tr>');} return _; My code:
rowTemplate: "<tr>" + "<td> <a href=\"BLOCKED SCRIPTself.close();window.parent.location='../vision/index.php?NIVEAU_V=2&societe=${NRID}'\"; >${NRID}</a></td> " "<td> {{if ${so0_libelle}=='CABINET GURTNER' }}${so0_libelle}{{else}}TOTO : ${so0_libelle}{{/if}}</td>" + "<td> ${so0_commune_insee}</td>" + "<td> ${so0_code_postal}</td>" + "<td> ${so0_sm}</td>" + "<td> ${so0_rc}</td>" + "<td> ${so0_conseiller}</td>" + "<td> <a href = \"BLOCKED SCRIPTvoid(0)\" onclick = \"window.location='popup15.php?nbOffre=${OFFRE}&societe=${NRID}'\";>${OFFRE}</a></td>" + "</tr>",if I try :
"<td> {{if 1==2 }}${so0_libelle}{{else}}TOTO : ${so0_libelle}{{/if}}</td>" +
It's work !
As soon as I put ${so0_libelle} in my condition, I get this error.
It seems to me that all the examples I've seen on the blog work like that.
Is something missing ?
my headers :
<script src="../netadvantage/js/json2.js" type="text/javascript"></script><script src="../js/ParamsTab.js" type="text/javascript"></script><script src="../js/TableMaker.js" type="text/javascript"></script><link href="../netadvantage/themes/min/ig/jquery.ui.custom.min.css" rel="stylesheet" type="text/css" /><link href="../netadvantage/themes/base/ig.ui.min.css" rel="stylesheet" type="text/css" /><link href="../netadvantage/demos/content/style.css" rel="stylesheet" type="text/css" /><script src="../netadvantage/demos/scripts/modernizr-1.7.min.js"></script><script src="../netadvantage/demos/scripts/jquery.min.js" type="text/javascript"></script><script src="../netadvantage/demos/scripts/jquery-ui.min.js" type="text/javascript"></script><script src="../netadvantage/demos/scripts/jquery.tmpl.min.js" type="text/javascript"></script><script src="../netadvantage/js/combined/min/ig.ui.min.js" type="text/javascript"></script>