I have a grid that has a description and 4 value columns. There are only 6 rows of records for this grid. In the first 4 rows, all 4 values are used with a label name. In the last two rows, only the 1rst value is used with a different label name. My question is If you click on one of the first 4 rows, I want the RowEditTemplate to display the labels and textboxes for editing all 4 columns, if one of the last two rows are clicked, I want to display only the labels & textboxes for editing the first column. Can I have more than one RowEditTemplate and, if so, how do I determine which one to use for the row clicked. If not, is there a way to do this, like if row 1-4 is clicked show such-and-such labels and textboxes, and if row 5-6 is clicked show only those labels and textboxes? This is a program requirement that I was able to do with a different third-party grid control in the past, but don't know how to do this with the UltraWebGrid. Thanks much for anyone who can help with this.
Hi dbishop9,
Thank you for your replies and for sharing your solution. Please feel free to contact me if you have any further questions.
Last followup. I have resolved the issue on my own. While this may not be the "best" way to do it, it is the only one so far that works for me. What I did was, in the BeforeRowTemplateOpenHandler, just before I assign the cell's date value to the WebDateChooser, I manually format the UTC date by using a bit of free javascript from the following link rather than spending time building my own formatting function.(I don't know if it's okay to include an outside link or not).
http://blog.stevenlevithan.com/archives/date-time-format
So my code is now as follows:
function igMyGrid_BeforeRowTemplateOpenHandler(gridName, rowId, templateId) { var row = igtbl_getRowById(rowId); var currentValDueDate = row.getCell(1).getValue(); var currentValueCompletedDate = row.getCell(6).getValue(); currentValDueDate = dateFormat(currentValDueDate, "mm/dd/yyyy"); currentValueCompletedDate = dateFormat(currentValueCompletedDate, "mm/dd/yyyy"); dateChooserDueDate.value = currentValDueDate; dateChooserDueDate.inputBox.value = currentValDueDate; dateChooserCompletedDate.value = currentValueCompletedDate; dateChooserCompletedDate.inputBox.value = currentValueCompletedDate;}
function igMyGridDueDate_InitializeDateChooser(oDateChooser) { dateChooserDueDate = oDateChooser;}function igMyGridCompletedDate_InitializeDateChooser(oDateChooser) { dateChooserCompletedDate = oDateChooser;
}
This now makes the WebDateChooser display the initial date value as 02/01/2012, as it is supposed to. Again, I'm still not sure what I have set/notset that was causing the previous methods to fail, but this overrides that and gives me the expected result I need, my project can continue now.
Hi Petar, another followup. I didn't know I had to specifically register the client-side events. I've never had to do that in other controls. Now that I've done that, the events are firing just fine. I still can't get the display format to be correct. The edit format is fine, and once you select a date, the format is fine, but that initial value is not displayed correctly. I have the control set to "d" and I've tried setting it in the server-side initalization of the row and the control itself, with no luck. How can I set it client-side?
This is a followup. I am able to debug javascript, however, NONE of the infragistics javascript is firing. If I create my own function for an input button like
alert(
"hi this is a test");
It fires and debugs. But my Infragistics scripts don't. such as
function igMyGrid_BeforeRowTemplateOpenHandler(gridName, rowId, templateId) {
"hi_BeforeRowTemplateOpenHandler");
var row = igtbl_getRowById(rowId);
var currentVal = row.getCell(2).getValue();
dateChooser.value = currentVal;
dateChooser.inputBox.value = currentVal;
var dateChooser = null;
function igMyGridDueDate_InitializeDateChooser(oDateChooser) {
//Add code to handle your event here.
"hi_InitializeDateChooser");
dateChooser = oDateChooser;
These do not fire! Is there some setting in the grid or otherwise to enable them to work? I don't see any mis-spellings in the naming. But I can't figure out what would keep them from firing.
Thanks, Petar. Apparently, the javascript isn't firing. I have set IE8 to allow debugging javascript, change the config mgr to Debug in VS2008. I put a debugger; call in the function, as well as alert('something here');, but neither will fire. I'm not used todebugging javascript in the IDE, so I may not have something still set right to debug it. But even so, the alert() call should fire, so I don't think my javascript is firing. Below is the script. I have to get this working and I'm not sure if VS2008 is even allowing me to debug the javascript. Is there a step to turning on javascript debugging Ive missed?
<script type="text/javascript">function igStop031_BeforeRowTemplateOpenHandler(gridName, rowId, templateId) { if (igtbl_getRowById(rowId).getIndex() < 4){igtbl_getElementById(templateId).children["divStop031Controls_A"].style.setAttribute('display','');igtbl_getElementById(templateId).children["divStop031Controls_B"].style.setAttribute('display','none');}else if (igtbl_getRowById(rowId).getIndex() == 4) {igtbl_getElementById(templateId).children["divStop031Controls_A"].style.setAttribute('display','none');igtbl_getElementById(templateId).children["divStop031Controls_B"].style.setAttribute('display','');} else if (igtbl_getRowById(rowId).getIndex() == 5){ igtbl_getElementById(templateId).children["divStop031Controls_A"].style.setAttribute('display','none');igtbl_getElementById(templateId).children["divStop031Controls_B"].style.setAttribute('display','');} } </script>