Can anyone help me to get current page number in sap ui5 Table Pagination .
For example if am in second page in pagination I have to get count of 2 if it is third page i have to get count of 3.
Hi krishnakumar sasthaiyan,
First get the ID of the table, and below line of code should work.
sap.ui.getCore().byId("TABLE_ID")._oPaginator.getCurrentPage();
Related
I have a sapui5 project with a graph made by vizframe. The graph has two dimensions (Date and Condition) and one measure
(Rest Value). The Rest Value is taken from invoices. But on one Date there can be multiple invoices of course. When this happens the vizframe graph automatically picks the first value he can find for this date, I think. Example: Date is 01.01.2023, there are four invoices for this date with the Rest Values: 1, 2, 3, 4. Because my model I get from the backend via Odata is ordered descending for Rest Value, the first value for this date is 4. Problem is I really have to display the lowest value for every date so i want the 1 not the 4. I hope my problem is understandable.
My graph is of vizType "timeseries_line". The Date is of course on the uid timeAxis, Dimension is uid color, and Rest Value on valueAxis. The sapui5 version im using is 1.108.0. The Vizframe is created in a xml view but the data binding is done in the controller with a FlattenedDataset and feeds.
I have been reading the sapui5 API Reference and asking ChatGPT questions but didnt get any smarter.
I hope someone can help me, thanks very much.
I did a lot of research but I could not find anything similar.
I am trying to get the total number of pages for my Object, so that i would be able to call the last page. This was the code i used
Page<Message> firstPage = defaultMessageService.getMessage(user, user2, new PageRequest(0, 6));
paginationModel.setMessagesPage(defaultMessageService.getMessage(user, user2, new PageRequest(firstPage.getTotalPages() - 1, 6)))
.setResponseMessage("Successful")
.setSuccessful(true);
in my code i called the first page, just to get the total number of pages and subtracted the the total pages by one, to get the last page. This is resource taking as i get the list of content with the page, contents i dont intend to use. Is there a better way ? i just want the total page, size, current page
if you want only last page then sort your data in descending order and then get the first page. is it possible to sort your data then your problem will be solved.
Can somebody help me out how to find the last_id in the current page? I am displaying 50 records inside a table using the query db.users.find().limit(50)
I want the id of the 50th record of the page and want to use it in the bellow query:
users = db.users.find({'_id'> last_id}). limit(50)
Thanks!
I guess your intent is to do pagination with MongoDB. We have better ways to do that. For instance:
//Page 1
db.users.find().skip(0).limit (10)
//Page 2
db.users.find().skip(10).limit(10)
//Page 3
db.users.find().skip(20).limit(10)
Change the skip value based on the page you are showing (i.e. (N-1) * 10).
Learn more.
Am working with iReport 4.0.1.
How can i limit columns per 1st page of table. From next page it should display remaining columns?
Can anyone provide me solution.
Is their any expression that implements above one?
Is there any way to find the current page is going to end in iTextSharp. For example,
say there are some 10 records which needs two pages to be written down at the end of the first page i wish to add '(contd on nex page'). IS there a way to do this. Will finding the end of page be an answer for this or is there a way to find the line number on which writing is done, so that i can make a calculation to decide whether to add a message of my choice and proceed to the next page.
any advise is much appreciated :)
Thanks a zillion
Usually, this is done by defining a footer for the table. When the table breaks automatically, iText will show that footer. Of course: you don't want this footer to show up on the last page (after the final row of the table). That's why there's also a method to skip the last row.
This example shows you how to create a table with headers and footers. This is the link to SkipLastFooter.
Note that saying that "finding the line number" would solve your problem is wrong for two reasons:
There is no such thing as a line number in a PDF file. You have a MediaBox and you draw content on the canvas defined by the MediaBox using coordinates.
There's a way to get the current Y-position on a page after adding an object to a document. You can get the Y-position before adding a table and after adding a table, but not while you're still creating the table.
An alternative solution to the one I suggested above, woult be to use table events.
If you really need to find the end of the page, and are not using a table with a footer row that will be printed at the end of each page, you can use the PdfWriter object as follows:
var remainingPageSpace = pdfWriter.GetVerticalPosition(false) - pdfDocument.BottomMargin;
This will give you the remaining space on the page, from which you can determine what you want to do next.
If you are using tabular data however, it is much preferred to use a PdfPTable and take advantage of the footer row feature.