Disable pagination First and Last buttons - tabulator

When using tabulator and the pagination feature, I want to disable First and Last buttons.
I tried using the paginationButtonCount property, and set it to 3 instead of the default 5, but that didn't change anything.
Is there a way to accomplish that?
Also, is there a way to set the enablement/disablement of the pagination buttons on my own?

For solving this, I inspected how the default pagination html looked like.
Then, I used tabulator's footerElement configuration in order to prepare my own footer element:
footerElement: preparePaginatorElement()
The resulting method looks like this:
function preparePaginatorElement() {
previousButton = document.createElement("button");
previousButton.classList.add("tabulator-page");
previousButton.type = "button";
previousButton.role = "button";
previousButton.ariaLabel = "Prev Page";
previousButton.title = "Prev Page";
previousButton.setAttribute("data-page", "prev");
previousButton.disabled = true;
previousButton.innerText = "Prev Page";
previousButton.addEventListener("click", () => changePage(currentPage - 1, true));
nextButton = document.createElement("button");
nextButton.classList.add("tabulator-page");
nextButton.type = "button";
nextButton.role = "button";
nextButton.ariaLabel = "Next Page";
nextButton.title = "Next Page";
nextButton.setAttribute("data-page", "next");
nextButton.disabled = true;
nextButton.innerText = "Next Page";
nextButton.addEventListener("click", () => changePage(currentPage + 1, true));
pageButton = document.createElement("button");
pageButton.classList.add("tabulator-page"/*, "active"*/);
pageButton.type = "button";
pageButton.role = "button";
pageButton.innerText = "1";
pageButton.style.cursor = "default";
const pagesSpan = document.createElement("span");
pagesSpan.classList.add("tabulator-pages");
pagesSpan.appendChild(pageButton);
const paginatorSpan = document.createElement("span");
paginatorSpan.classList.add("tabulator-paginator");
paginatorSpan.appendChild(previousButton);
paginatorSpan.appendChild(pagesSpan);
paginatorSpan.appendChild(nextButton);
const footerContentsDiv = document.createElement("div");
footerContentsDiv.classList.add("tabulator-footer-contents");
footerContentsDiv.appendChild(paginatorSpan);
const footerDiv = document.createElement("div");
footerDiv.classList.add("tabulator-footer");
footerDiv.appendChild(footerContentsDiv);
return footerDiv;
}

Related

Jetpack Compose - How Do I program this composable to access the "url" in the "list"

//I'm having problems trying to get the title text in the KbfPlayScreen.kt to access the "url" in the list that is in the Data.kt on button click.
**KbfPlayScreen.kt**
#Composable
fun KbfSermonsView(sermons: List<Sermon>) {
Column() {
sermons.forEach {
SermonRow(it.title, it.timestamp)
Divider(thickness = 1.dp, modifier = Modifier.padding(top = 5.dp, bottom = 5.dp))
}
}
}
**Data.kt**
val kbfList = listOf<Kbf>(
Kbf(
title = "The Purpose Of KBF", description = "", imageId = R.drawable.kbf_tony, sermons =
listOf<Sermon>(
Sermon(title= "The Purpose Of KBF", image= "kbf_tony", url=
"https://www.youtube.com/embed/O5xZCZlCqBw", timestamp= "1612674000"),
)),
Kbf(
title = "Goal Setting", description = "", imageId = R.drawable.kbf_mike, sermons =
listOf<Sermon>(
Sermon(title = "Goal Setting", image = "kbf_mike", url =
"https://www.youtube.com/embed/HRDPWpUagxY", timestamp = "1612674000")
))
)

Hide a product in Kentico 10

I am performing CRUD operations for products of e-commerce site in kentico 10.I can add and update products using below API
SKUInfoProvider.SetSKUInfo(updateProduct);
Also there is an API for deleting product
SKUInfoProvider.DeleteSKUInfo(updateProduct);
But I do not wish to delete the product from database,rather just disable them so that they do not show up to the end users and still stay in the database .
I tried to set SKUEnabled as false but still user can see the product.So, I used below code to hide the products
ProductNode.SetValue("DocumentPublishTo", DateTime.Now.AddDays(-1));
But my code setup adds a new product with above disabled property.Here is my code
foreach (DataRow dr in dt.Rows)
{
manufacturer = GetManufacturer(Convert.ToString(dr["MANUFACTURER_NAME"]));
department = GetDepartment(Convert.ToString(dr["CATEGORY_OF_PRODUCT_1"]));
var sku = new SKUInfo
{
SKUNumber = Convert.ToString(dr["MANUFACTURER_PART_NUMBER"]),
SKUName = Convert.ToString(dr["MANUFACTURER_PART_NUMBER"]),
SKUDescription = Convert.ToString(dr["TECHNICAL_SPECIFICATIONS"]).Trim('"'),
SKUShortDescription = Convert.ToString(dr["SHORT_DESCRIPTION"]).Trim('"'),
SKUPrice = ValidationHelper.GetDouble(dr["RESELLER_BUY_INC"], 0),
SKURetailPrice = ValidationHelper.GetDouble(dr["RRP_INC"], 0),
SKUEnabled = false,
SKUSiteID = siteId,
SKUProductType = SKUProductTypeEnum.Product,
SKUManufacturerID = manufacturer.ManufacturerID,
SKUDepartmentID = department.DepartmentID,
SKUHeight = ValidationHelper.GetDouble(dr["HEIGHT"], 0),
SKUWidth = ValidationHelper.GetDouble(dr["WIDTH"], 0),
SKUWeight = ValidationHelper.GetDouble(dr["WEIGHT"], 0),
SKUDepth = ValidationHelper.GetDouble(dr["LENGTH"], 0),
SKUAvailableItems = 1,
SKUSellOnlyAvailable = true
};
try
{
SKUInfo updateProduct = SKUInfoProvider.GetSKUs()
.WhereEquals("SKUNumber", sku.SKUNumber)
.FirstObject;
sku.SKUPrice += sku.SKUPrice * 0.015;
if (updateProduct != null)
{
updateProduct.SKUNumber = sku.SKUNumber; updateProduct.SKUName = sku.SKUName;
SKUInfoProvider.SetSKUInfo(updateProduct);
}
else
{
SKUInfoProvider.SetSKUInfo(sku);
}
if (!sku.SKUEnabled)
{
SKUTreeNode productDoc = (SKUTreeNode)SKUTreeNode.New(productDocumentType.ClassName, tree);
if (sku.SKUEnabled == false)
{
productDoc.DocumentPublishTo = DateTime.Now.AddDays(-1);
}
productDoc.DocumentSKUName = Convert.ToString(dr["MANUFACTURER_PART_NUMBER"]);
productDoc.DocumentSKUDescription = sku.SKUDescription;
productDoc.NodeSKUID = sku.SKUID;
productDoc.DocumentCulture = cultureCode;
productDoc.DocumentName = Convert.ToString(dr["MANUFACTURER_PART_NUMBER"]);
}
}
catch (Exception ex)
{
error += "error";
}
}
Please provide the possible solution.There ain't no property such as DocumentPublishTo in SKUInfo,hence I used it with SKUTreeNode which you can find in code setup.
SKUTreeNode productDoc = (SKUTreeNode)SKUTreeNode.New(productDocumentType.ClassName, tree);
if (sku.SKUEnabled == false)
{
productDoc.DocumentPublishTo = DateTime.Now.AddDays(-1);
}
You need to get the node for the SKU, not create a new one. from the documentation :
SKUTreeNode productDoc = (SKUTreeNode)tree.SelectNodes()
.Path("/Products/NewProduct")
.OnCurrentSite()
.CombineWithDefaultCulture()
.FirstObject;
productDoc.DocumentPublishTo = DateTime.Now.AddDays(-1)

object cant inherit properties

I get stack. PLZ help.
In class "work" i creating a frame of a table. Than in object "myWork1" i must fill that frame of a table.
But it didnt works. Finally i want to creating a table with special information in it.
What im doing wrong?
<p id="demo">demo</p>
function work(td1) {
this.firstWork = function(){
var table = document.createElement("table");
var table_tr = document.createElement("tr");
var table_td = document.createElement("td");
var table_td_text = document.createTextNode(this.td1=td1);
table_td.appendChild(table_td_text);
table_tr.appendChild(table_td);
table.appendChild(table_tr);
io.appendChild(table);
}
}
var myWork1 = new work("111");
document.getElementById("demo").innerHTML =
return myWork1.tableWork();
<p id="demo">demo</p>
function work(td1) {
this.firstWork = function(){
var table = document.createElement("table");
var table_tr = document.createElement("tr");
var table_td = document.createElement("td");
var table_td_text = document.createTextNode(td1);
table_td.appendChild(table_td_text);
table_tr.appendChild(table_td);
table.appendChild(table_tr);
return table;
}
}
var myWork1 = new work("111");
document.getElementById("demo").appendChild(myWork1.firstWork());
A working example here : jsfiddle

RoutingOrder does not work

When I am getting envelope by RequestStatus all recipients have same routing number. But I am sure and debug that provided different parameter for each recipient. And all recipients gets email in same time. How can I send envelope for each recipient according to RoutingOrder?
Sequential Signing (API) enabled for my account:
My examlple:
WebAPI.Recipient[] recipients = {new WebAPI.Recipient(), new WebAPI.Recipient()};
recipients[0].Email = "JohnDo#gmail.com";
recipients[0].UserName = "John Do";
recipients[0].Type = WebAPI.RecipientTypeCode.Signer;
recipients[0].ID = "2";
recipients[0].RoutingOrder = 2;
recipients[1].Email = "JohnDo2#gmail.com";
recipients[1].UserName = "John Do2";
recipients[1].Type = WebAPI.RecipientTypeCode.Signer;
recipients[1].ID = "1";
recipients[1].RoutingOrder = 1;
// Create envelope
WebAPI.Envelope envelope = new WebAPI.Envelope();
envelope.Subject = "Subject line mandatory!";
envelope.Recipients = recipients;
envelope.AccountId = APIAccountId;
// Create document
envelope.Documents = new WebAPI.Document[1];
WebAPI.Document doc = new WebAPI.Document();
doc.ID = "1";
doc.Name = "Picture PDF";
doc.TransformPdfFields = true;
doc.PDFBytes = Properties.Resources.test;
envelope.Documents[0] = doc;
// Create tab
WebAPI.Tab tab = new WebAPI.Tab();
WebAPI.AnchorTab anchorTab = new WebAPI.AnchorTab();
anchorTab.AnchorTabString = "Adobe";
anchorTab.IgnoreIfNotPresent = true;
anchorTab.IgnoreIfNotPresentSpecified = true;
tab.AnchorTabItem = anchorTab;
tab.CustomTabRequired = false;
tab.SenderRequired = false;
tab.Type = WebAPI.TabTypeCode.SignHere;
tab.DocumentID = "1";
tab.RecipientID = "1";
WebAPI.Tab tab2 = new WebAPI.Tab();
WebAPI.AnchorTab anchorTab2 = new WebAPI.AnchorTab();
anchorTab2.AnchorTabString = "CustomTag";
anchorTab2.IgnoreIfNotPresent = true;
anchorTab2.IgnoreIfNotPresentSpecified = true;
tab2.AnchorTabItem = anchorTab2;
tab2.Type = WebAPI.TabTypeCode.SignHere;
tab2.DocumentID = "1";
tab2.RecipientID = "2";
tab2.SenderRequired = false;
tab2.SharedTab = true;
tab2.TabLabel = "CustomTag";
tab2.Value = "Value2";
envelope.Tabs = new WebAPI.Tab[2];
envelope.Tabs[0] = tab;
envelope.Tabs[1] = tab2;
// Get results
WebAPI.EnvelopeStatus status = apiClient.CreateAndSendEnvelope(envelope);
Request to DocuSing SOAP API:
Request to DocuSing SOAP API
Problem resolved by adding option: for RoutingOrderSpecified = true each recipient ;
This code resolve problem for me:
recipients[0].RoutingOrderSpecified = true;
recipients[1].RoutingOrderSpecified = true;

YUI DataTable with TEXT responseType

//Define the columns of the table
var myColumnDefs = new Array();
for ( i=0; i < $names.length ; i++)
{
var colObjConfig = new Object();
colObjConfig.label =$names[i];
colObjConfig.resizeable =true;
colObjConfig.width =150;
myColumnDefs.push ( new YAHOO.widget.Column(colObjConfig));
}
var beginningScoreRow = "1111,1111|1111,1111";
var myDataSource = new YAHOO.util.FunctionDataSource( function () {
return beginningScoreRow ;} );
myDataSource.responseType = YAHOO.util.DataSource.TYPE_TEXT;
myDataSource.responseSchema = {
fieldDelim : ",",
recordDelim : "|"
};
var myDataTable = new YAHOO.widget.DataTable("statusTable", myColumnDefs,
myDataSource);
I want to use TYPE_TEXT responseType for a YUI DataSource. But the above failed to render the data in the YUI table column cells. I do not see any error in JS console either.
What am i missing?
var column = new YAHOO.widget.Column(colObjConfig);
column.field = ""+i+"";
myColumnDefs.push (column );
Changed the column definition to add the field property and it did the trick...

Resources