Reputation: 840
I want to use pnotify like status bar. I'm saving some records to database and i want to show that in pnotify like this.
"Saving 28 / 209"
But i didn't see any example to change pnotify content after it's open.
Here my javascript. This works but open a lots of notify.
var sayac = 0;
var i = setInterval(function () {
var veriler = {
NotPuan: nesneler[sayac].value,
OgrenciID: nesneler[sayac].alt,
PayID: nesneler[sayac].name
};
var listele = $.post("NotGiris/NotKaydet", veriler);
$.pnotify({
title: 'DURUM',
text: 'Kaydediliyor' + sayac + ' / ' + nesneler.length,
type: 'success',
delay: 1000
});
console.log(Date());
sayac++;
if (sayac === nesneler.length) {
clearInterval(i);
window.location.replace('/Ders/Detay?Uyari=1');
}
}, 200);
Upvotes: 0
Views: 2204
Reputation: 567
I think what you are looking for is the update function on the pnotify instance.
var notice = new PNotify({
title: 'Regular Notice',
text: 'Check me out! I\'m a notice.'
});
$("#update").on('click', function() {
notice.update({
title: 'Updated title!'
})
});
... i.e., simply save the instance you are creating and then call .update(options)
on it.
See it in action on Plunkr.
Upvotes: 1
Reputation: 840
Thanks to Tadeas. I solved.
var notice = new $.pnotify({
title: 'UYARI',
text: '',
type: 'success',
delay: 200000
});
$(".ui-pnotify-history-container").remove();
var sayac = 0;
var i = setInterval(function () {
var veriler = { NotPuan: nesneler[sayac].value, OgrenciID: nesneler[sayac].alt, PayID: nesneler[sayac].name };
var listele = $.post("NotGiris/NotKaydet", veriler);
//$.pnotify({ title: 'DURUM', text: 'Kaydediliyor' + sayac + ' / ' + nesneler.length, type: 'success', delay: 200 });
notice.pnotify({
title: 'UYARI',
text: 'Kaydediliyor: ' + sayac + ' / ' + nesneler.length, delay: 200000,
type: 'success',
delay: 200000
})
//$.pnotify.pnotify({text: 'Kaydediliyor' + sayac + ' / ' + nesneler.length, delay: 200000})
console.log(Date());
sayac++;
if (sayac === nesneler.length) {
clearInterval(i);
window.location.replace('/Ders/Detay?Uyari=1');
}
}, 200);
Upvotes: 0