In fact we can use numberOfRowsLoaded on a linked form data source; however, it shows the number of those cached only.
So, if you are editing row number 28, for example, and then call ExecuteQuery() on the data source, you will probably get a lower number of rows loaded in the grid yet, say, 19.
In order to get the right number, you should use the aforementioned method together with allRowsLoaded() one.
So, if you are editing row number 28, for example, and then call ExecuteQuery() on the data source, you will probably get a lower number of rows loaded in the grid yet, say, 19.
In order to get the right number, you should use the aforementioned method together with allRowsLoaded() one.
public int myNumberOfRowsLoaded() { int myNumOfRec; int myCounter; myNumOfRec = PSAActivityEstimates_DS.numberOfRowsLoaded(); // nothing to load yet if(!myNumOfRec) { return myNumOfRec; } // so far we numbered those lines cached only while(!PSAActivityEstimates_DS.allRowsLoaded()) { // so let's move it on until the end of loading PSAActivityEstimates_DS.setPosition(myNumOfRec); PSAActivityEstimates_DS.getNext(); // just to avoid never ending adventure if(myCounter>1000) { break; } myCounter++; // get the number for the next iteration myNumOfRec = PSAActivityEstimates_DS.numberOfRowsLoaded(); } // now all numberOfRowsLoaded() calls will return the correct number of rows in grids myNumOfRec = PSAActivityEstimates_DS.numberOfRowsLoaded(); return myNumOfRec; }
No comments:
Post a Comment