I'm using MVC3 / Razor.
I'm using continuous virtualization in my igGrid, and using the examples, I hooked the iggriddatarendered event and use row templating to conditionally change the background color of rows.
This all works well until the grid pulls in additional data as I scroll down- after grabbing more data, the style that was applied for the first chunk of data stops being applied; I'm assuming that the iggriddatarendered event isn't being fired, but can't figure out why.
Any help would be appreciated.
Thanks,
Charlie
An example of what I'm doing:
@section Body{
<script type="text/javascript"> $.ig.loader(function(){$("#PFL").live("iggriddatarendered", function(evt, ui){
var criticalItems = $(".criticalAttention");
$.each(criticalItems,function(key, value){$(value).parent().addClass("rowCriticalAttention");});
});
</script>
<style type="text/css">.rowCriticalAttention {background-color: #FF7283;}
</style>
@(Html.Infragistics().Grid<PGMTest.ProjectFund>()
.ID("PFL")
.AutoGenerateColumns(false)
.Caption("Project Funds")
.RowTemplate("<tr><td>{{if parseInt(${Neg}) > 0}}<span class='criticalAttention'>${PI}</span> {{else}} ${PI}{{/if}}" + "</td>"+
....etc...
Hi Charlie,
I'm glad you solved your issue. If you have any other questions, please do not hesitate to contact us.
Martin,
Thanks for the reply. All it took was hooking up the iggridvirtualrecordsrender event.
Thanks for your help,
First, dataRendered event is not fired by continuous virtualization. That's why your code is not working. dataRendered is fired for example on initialization, rebinding, commit, rollback.
Second, templating should work in continuous virtualization mode out of the box, so you don't need to hook to dataRendered or any other event in order to make it work. I'm afraid that from information you provide I cannot conclude what can be the problem in your case. It will be good to provide the whole chaining code for your scenario(or the JavaScript code which chaining generated).
There is an internal "iggridvirtualrecordsrender" event which is fired by virtualization when another chunk of data is rendered. I attached a sample I've created which shows igGrid configured with continuous virtualization and row template. The sample demonstrates two cases:
First is that row template applies red color to rows with even ProjectId.
This case also shows that templating is working with continuous virtualization(I know it is html, but what MVC Wrappers do is to generate JavaScript code so at the end it is pure JavaScript on the client side).
Second case shows your scenario. Keep in mind that iggridvirtualrecordsrender is not fired initially so you need to keep dataRendered event binding.
Best regards,
Martin Pavlov
Infragistics, Inc.