Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
I'm trying to read data from object via Document.GetObject API, but I've got some issues:
When I'm trying to read by chunks I use PageObject (forum) method:
_this.Doc.GetObject(name, function () {
this.Data.Page = new this.Data.PageObject(this.Data, 100, 1)
this.Data.Page.Next()
log('Page.Next(): ', this.Data.Page.Count, this.Data.Page.Current)
this.Data.Page.Next()
this.Data.Page.Next()
this.Data.Page.Next()
this.Data.Page.Next()
var item = this.Data.Page.StartItem()
log('Page.Next() x 4: ' , this.Data.Page.Count
, this.Data.Page.Current
, item
, this.Data.Rows.length)
As a result output in console via QvConsole extension:
> Page.Next(): 21 2
> Page.Next() x 4: 21 6 500 40
So Page.Next() call changes page meta data like Page.Current, but does not change this.Data.Rows, however in JS API Documentation we can see:
Index to start reading data from in order to display data for the current page
Example:
var item = this.Data.Page.StartItem();
var text = this.Data.Rows[item][1].text
We had got 500 as a result of StartIndex() call, when there is only 40 rows in data...
So my question is how can I read page data in GetObject callback?
For the last question about how to unsubscribe from object updates I find only two methods:
function getData(name) {
var done = false
_this.Doc.GetObject(name, function () {
if (done) return
// Some logic on Object data
done = true
})
}
function getData(name) {
_this.Doc.GetObject(name, function () {
// Some logic on Object data
this.callbackFn = function() {}
})
}
Is it only available options to do unsubscribe? They both seems to be not so obvious and clean.