@@ 19,7 19,7 @@ ListModel {
pmConvModel.reload();
}
- function reload() {
+ function reload(cbk) {
console.log("PMConversationModel.reload()");
var doc = new XMLHttpRequest();
doc.onreadystatechange = function() {
@@ 32,14 32,15 @@ ListModel {
data = JSON.parse(data);
if (data.length > 0) {
//data.reverse();
- var k;
+ var k, t = data.length-1;
for (k in data) {
- var msg = data[k];
+ var msg = data[t-k];
pmConvModel.append(msg);
}
reply_id = data[0].id;
}
pmConvModel.status = "ready";
+ if (cbk) cbk();
} else {
pmConvModel.status = "error";
console.log("PMConversationModel xhr error");