In NetVantage_2008 CLR3X ASP.NET, in ig_WebGrid_dom.js, there is something that is screwing up my usage of the web grid control (I need finer control of the scrolling for Virtual mode) something fierce:
"getDefaultRowHeight",function(){ var rh=igtbl_parseInt(this.Bands[0].DefaultRowHeight); if(!rh) rh=22; if(igtbl_isXHTML) rh+=2; return rh;},
igtbl_isXHTML is set when the document.compatMode is "CSS1Compat, i.e. non "Quirks Mode".
The problem is that these two extra pixels that getDefaultRowHeight adds to the row height are not actually there in IE7. With a server-assigned default row height of 16, this function returns 18, but it is clear from a count of the rows on-screen that the row height is actually 16.
I tried looking at the Infragistics samples page to see if there were any issues from this, but the Infragistics ASP.NET samples page uses quirks mode, and thus would not trigger the extra two pixels.
(For those who want to see what mode a page uses, type this into the address bar after the web page loads, type javascript followed by a colon and then alert(document.compatMode) )
What are these extra two pixels for? IE6? Firefox?
Is there any proper way to get rid of these? There are too many things using getDefaultRowHeight for me to just use igtbl_parseInt(this.Bands[0].DefaultRowHeight) everywhere I go.
Regards,
-- Ritchie Annand
Alrite thanks. that helped.
I can tell you what I did :)
I made a function like this:
function overrideGridRowHeightDetermination() { // Override the grid's getDefaultRowHeight which includes 2 extra hardcoded pixels igtbl_Grid.prototype["getDefaultRowHeight"] = function() { var rh = igtbl_parseInt(this.Bands[0].DefaultRowHeight); if (!rh) rh = 22; return rh; } }
I included that in one of our .aspx pages that uses the Infragistics grids, and right at the end, in the body, called it:
<script type="text/javascript">overrideGridRowHeightDetermination();</script>
...
You could probably just override it all in one go by just calling the code directly in a <script> area in the body (just before the </body> should work):
<script type="text/javascript">igtbl_Grid.prototype["getDefaultRowHeight"] =function() {var rh = igtbl_parseInt(this.Bands[0].DefaultRowHeight);if (!rh) rh = 22; return rh;}</script>
Hi Tony,
Could you please explain me with an example of using proto type to over ride the function, so that it will affect grid on every page ?
Thanks,
Praveen.
Thanks, Tony! I will remember that for next time. The prototype trick did actually work really well, on top of teaching me a trick or two about JavaScript in the process (I was sure puzzled at first by the giant array of names and functions in ig_WebGrid_dom.js!), but it's probably kinder to override the functions in the client-side event.
Cheers,
Ritchie,
You can use the InitializeGrid client-side event to override the JS function. That function is the first thing that fires after the Grid's client-side object is fully built. You can either do it through the prototype, which will affect every grid on the page, or you can do it through the instance member. I normally go through the instance, so something like:
function InitializeGrid(id){var grid=igtbl_getGridByID(id);grid.getDefaultRowHeight=function(){/*insert logic here...*/};}