Poor Performance with images

Poor Performance with images

amun1000amun1000 Posts: 7Questions: 1Answers: 0
edited August 2013 in General
Hi
We are using Signal-R to append alarm objects with an image url to a datatable.

The initial 'get' call is an IEnumerable list of alarm objects which are then added to the datatable in the following function
[code]
sr_alarm.server.getAlarms().done(function (alarms) {
$.each(alarms, function () {
addAlarm(this);
});
});

function addAlarm(alarm) {

alarmTable.fnAddData(formatAlarm(alarm));

}

function formatAlarm(alarm) {

return $.extend(alarm, {
Colour: '',
Image: '',// imageUrl,
When: moment(alarm.When).format('L HH:mm'),
Id: alarm.HotListId,
Instruction: alarm.Instruction,
ColourHidden: alarm.Colour
});
[/code]



The alarm object has a property called imageURL which when filled extends the displaying of the rows. For 100 rows the time is ~13 secs. However when the imageURL is empty the loading time is reduced by 6 seconds. Is there a way to optimize this process?

Timings for IE (seconds)
Getting Alarms : Time:00:000
Start Adding Rows: Time:2.373
End Adding Rows: Time:16.016


Also the alarm object being passed into the table is $.extended before adding the row, but is there a preferred method to pass custom objects into the table (json etc) rather than just passing in a javascript object?

TIA

Andrew

Replies

  • allanallan Posts: 63,514Questions: 1Answers: 10,472 Site admin
    Call fnAddData with the second parameter as false if you are calling it more that once. Otherwise it is redrawing the table (including a full resort and refilter for the new data) on every call. Then when you are done adding data just call fnDraw .

    Allan
  • amun1000amun1000 Posts: 7Questions: 1Answers: 0
    Cheers Allan

    I'll give that a try in the morning - thanks for the prompt reply
This discussion has been closed.