1
0
mirror of https://github.com/owncloudarchive/contacts.git synced 2024-12-03 15:24:09 +01:00

Contacts: Select first *visible* contact on load.

This commit is contained in:
Thomas Tanghus 2013-02-24 02:48:43 +01:00
parent 9b55ac8999
commit ac8fe794ac

View File

@ -1323,7 +1323,7 @@ OC.Contacts = OC.Contacts || {};
}; };
Contact.prototype.next = function() { Contact.prototype.next = function() {
var $next = this.$listelem.next('tr'); var $next = this.$listelem.next('tr:visible');
if($next.length > 0) { if($next.length > 0) {
this.$listelem.removeClass('active'); this.$listelem.removeClass('active');
$next.addClass('active'); $next.addClass('active');
@ -1336,7 +1336,7 @@ OC.Contacts = OC.Contacts || {};
}; };
Contact.prototype.prev = function() { Contact.prototype.prev = function() {
var $prev = this.$listelem.prev('tr'); var $prev = this.$listelem.prev('tr:visible');
if($prev.length > 0) { if($prev.length > 0) {
this.$listelem.removeClass('active'); this.$listelem.removeClass('active');
$prev.addClass('active'); $prev.addClass('active');
@ -1659,6 +1659,7 @@ OC.Contacts = OC.Contacts || {};
}; };
ContactList.prototype.setCurrent = function(id, deselect_other) { ContactList.prototype.setCurrent = function(id, deselect_other) {
console.log('ContactList.setCurrent', id);
if(!id) { if(!id) {
return; return;
} }
@ -1765,6 +1766,7 @@ OC.Contacts = OC.Contacts || {};
} }
setTimeout(function() { setTimeout(function() {
self.doSort(); self.doSort();
self.setCurrent(self.$contactList.find('tr:visible:first-child').data('id'), false);
} }
, 2000); , 2000);
$(document).trigger('status.contacts.loaded', { $(document).trigger('status.contacts.loaded', {
@ -1772,7 +1774,6 @@ OC.Contacts = OC.Contacts || {};
numcontacts: jsondata.data.contacts.length, numcontacts: jsondata.data.contacts.length,
is_indexed: jsondata.data.is_indexed is_indexed: jsondata.data.is_indexed
}); });
self.setCurrent(self.$contactList.find('tr:first-child').data('id'), false);
} }
if(typeof cb === 'function') { if(typeof cb === 'function') {
cb(); cb();