I'm using PageList.MVC to show the paging and I wondering how can I show
Showing items 99 through 99 of 9999
I have used this below code but its showing with-in the control:
#Html.PagedListPager((IPagedList)ViewBag.OnePageOfData, page => Url.Action("Index", new { page = page }), PagedListRenderOptions.MinimalWithItemCountText)
What I'm looking is to just show the label that says:
Showing items 99 through 99 of 9999
There's nothing that will print just that for you. You'll have to construct the text yourself using the data on your IPagedList instance:
#{ var pagedList = (IPagedList)ViewBag.OnePageOfData; }
<p>
Showing items
#((pagedList.PageNumber - 1) * pagedList.PageSize + 1)
through
#(pagedList.PageNumber * pagedList.PageSize)
of
#pagedList.TotalItemCount
</p>
Related
I am creating a web app in asp.net-mvc I have a Kendo Grid, the data of the grid is being translated into hindi-(India) language,
The data is translating properly in controller
controller code looks like below,
model.NextActionTooltip = (NextActionObject) == null ? "--" : NextActionObject.HoverText;
gridTextTobeTranslatedList.Add(model.NextActionTooltip);
MyRegistrationsList.Add(model);
MultiLanguageAuthentication multilang = new MultiLanguageAuthentication(SessionManager.MultiLanguageClientId,
SessionManager.MultiLanguageClientSecret);
if (!string.IsNullOrEmpty(SessionManager.TargetLanguage) && !SessionManager.TargetLanguage.ToLower().Contains("en"))
{
GridTranslatedText = multilang.TranslateArrayMethod(gridTextTobeTranslatedList.ToArray(), SessionManager.TargetLanguage, SessionManager.SourceLanguage);
for (int i = 0; i < MyRegistrationsList.Count(); i++)
{
MyRegistrationsList[i].Status = GridTranslatedText[MyRegistrationsList[i].Status];
MyRegistrationsList[i].NextActionTooltip = GridTranslatedText[MyRegistrationsList[i].NextActionTooltip];
}
}
but when I look at my view instead of translated text, (???????) is appearing in my grid
Have a look at my grid
I am calling the function from grid like below
.Events(x => x.DataBound("onDataBound")).DataSource(datasource => datasource.Ajax().Read(read => read.Action("Registration", "Registrations")).PageSize(ViewBag.PageSize))
my network panel
I am not able to understand the problem with kendo grid event for translated text,
What is the problem as per you?
I suggest submitting a ticket to Telerik and asking them what the issue is. This could be a bug inside their translation code.
I'm using pdfmake to generate a document that contains a number of sub-documents, e.g. a PDF containing invoices; each invoice is a logical document inside the PDF document.
I have a requirement that in the footer or header of each page I show "Page of " where both those numbers are relative to a single invoice, and not the overall document.
The header and footer callbacks look good, but only specify the page number and count relative to the entire document, and the pageBreakBefore callback doesn't generate anything like the documented information, and in any case I can't figure out how I could use it here.
This doesn't seem like a unique requirement, so hopefully I'm just missing something obvious.
Thanks!
I believe that pdkmake's header and footer function's arguments can only contain the global pageCount.
There is however a way to reproduce the behavior that you want, if you handle manually the pageBreaks :
const realPageIndexes = [];
let currSubPdfIdx = 0;
let currPageCountForSubPdf = 0;
const getPageBreak = (newSubPdfIdx: number) => {
if (currSubPdfIdx !== newSubPdfIdx) {
currSubPdfIdx = newSubPdfIdx;
currPageCountForSubPdf = 0;
} else {
currPageCountForSubPdf += 1;
}
realPageIndexes.push(currPageCountForSubPdf);
return {text: '', pageBreak: 'after'}; // return elem causing the pageBreak
}
The footer function, filling the page numbers, is called once the document definition generation is done.
If you handle every overflow by yourself, by calling getPageBreak(currentSubPdfIndex) at the end of each page, you will end up knowing which sub-Pdf is displayed in each page :
I display part of the 1rst subPdf in page 1:
I display the end of 1rst subPdf in page 2
I display 2nd subPdf in page3
I display 3rd subPdf in page4 ....
.
let subPdfIdx = 0;
pdfContent.push(subPdf1FirstPart)
pdfContent.push(getPageBreak(subPdfIdx))
pdfContent.push(subPdf1SecondPart)
pdfContent.push(getPageBreak(subPdfIdx))
subPdfIdx++;
pdfContent.push(subPdf2)
pdfContent.push(getPageBreak(subPdfIdx))
subPdfIdx++;
pdfContent.push(subPdf3)
pdfContent.push(getPageBreak(subPdfIdx))
realPageIndexes[] then looks like :
[ 1, 1, 2, 3 ];
The only step left is to tell the footer function to use the page counts we just created instead of the global page count :
const documentDefinition = {
content: [YOUR CONTENT],
footer: (currPage, allPages) => 'subPdf index is ' + realPageIndexes[currPage];
}
Please note that this method will fail if you don't handle overflows correctly:
if for example a paragraph is too big to fit a page, and you call getPageBreak() after that, pdfmake will automatically create a new page for the end of the paragraph (page which is untracked in our realPageIndexes) and then add the page caused by your getPageBreak() right after the end of the text. So just make sure not to overflow the page :)
I want to create an ellipsis that when the string length is more than 200, it displays ... and when it is clicked the remaining text are displayed.
I was able to show the ellipsis ..., but the issue I have is that:
Its not displaying as hyperlink
How do I update the function I wrote to be able to display the remaining text when ... is clicked
This is the function
public static string DisplayText(this string str, int charallowed)
{
if (str.Length > charallowed)
return str.Substring(0, charallowed) + " ....";
return str;
}
View
#Html.Raw(#BPP.CCSP.Admin.Web.Helpers.ClipText.DisplayText(item.OPTION_VALUE, 200))
This is the result I have presently
Please what do I do.
To display it as hyperlink
update the function I wrote to be able to display the remaining text when ... is clicked
I have a PrimeFaces DataTable where I have pagination (the component one, no custom) in form of two arrows (back and forward).
The table never knows how many rows are there, so I have the following function to set the rows count (keep in mind that the dataSize parameter is for a pageSize of 25 rows always 25 or less):
if(pageNumber == 0 && dataSize < pageSize) {
setRowCount(dataSize);
} else if(pageNumber != 0 && dataSize < pageSize) {
setRowCount(pageNumber*pageSize + dataSize);
} else {
setRowCount(pageSize*(pageNumber+1) + 1);
}
With this function called in the load method after fetching the data, there are always one page or two pages or three pages. Depending on the current position of the first record the back arrow or the forward arrow are disabled or enabled. This all works well so far.
Now I want to be able to load the table on a given page. If I have a pageNumber the correct set of data is displayed but only the forward arrow is enabled. So the DataTable thinks that it is on the first page. I tried to call the setRowIndex() before or after my function but no luck.
Does anybody know how to make DataTable think that there is also a page before the current one?
I have a splitter. In this splitter, I am implementing drag and drop functionality for the list view. Each list view is loaded in "table" format.
I want to drag my list view from left to right.
For the 1st list view, I have this code :
var listViewOptions = {
template: kendo.template(
$("#Firsttemplate").html()
),
dataSource: listdatSource,
};
var sourceListView = $("#First").kendoListView(listViewOptions).data("kendoListView");
var draggableOptions = {
filter: "table",
hint: function (e) {
return $('<div class="new">' + e.html() + '</div>');
}
}
sourceListView.element.kendoDraggable(draggableOptions);
In the filter, if I give "table" / "tbody" the whole content of list view is dragging in a row format and after dropping it is in the right side of splitter and is displaying in a single row. I want to display in the same format as in the leftside.
Can you tell me how to do this?
Thanks
somejQueryElement.html() gives you the inner HTML code of your element. Thus, if you filter on table elements, your argument e of the hint function is the table and e.html() is the content of the table.
If you want to have your table, you have to add reencapsulate the element in table tags :
var draggableOptions = {
filter: "table",
hint: function (e) {
return $('<div class="new"><table>' + e.html() + '</table></div>');
}
}