Custom BusinessDataListWebPart Pagination (Next Button) - pageindex never changes - sharepoint

Pagination (Next button) doesn't work for custom BusinessDataListWebPart.
I am adding BusinessDataListWebPart using code. Everything works fine. I can see 20 data raw at the same time but when I click "Next Button", I can not see next 20-40 data. A postback occurs, but the pageindex never changes.
I am using following code to add BusinessDataListWebPart to the Sharepoint site.
BusinessDataListWebPart consumer = new BusinessDataListWebPart();
consumer.Title = title;
consumer.Application = instance.Name;
consumer.Entity = projEntity.Name;
consumer.XslLink = "/Style%20Library/XSL%20Style%20Sheets/" + xslFileName;
consumer.PageSize = 20;

OK..I found the answer.
For pagination I needed to add "ParameterBindings" to the business data list webpart.
My final code is, It works perfect.
BusinessDataListWebPart consumer = new BusinessDataListWebPart();
ServerContext serverContext = ServerContext.GetContext(site);
SqlSessionProvider.Instance().SetSharedResourceProviderToUse(serverContext);
LobSystemInstance instance = ApplicationRegistry.GetLobSystemInstanceByName(applicationName);
Entity projEntity = instance.GetEntities()[entityName];
consumer.Title = title;
consumer.Application = instance.Name;
consumer.Entity = projEntity.Name;
consumer.XslLink = "/Style%20Library/XSL%20Style%20Sheets/" + xslFileName;
consumer.PageSize = 20;
consumer.ParameterBindings = "<ParameterBinding Name=" + "\"dvt_firstrow\"" + " Location=" + "\"Postback;Connection\"" + "/>" +
" <ParameterBinding Name=" + "\"dvt_sortdir\"" + " Location=" + "\"Postback;Connection\"" + "/>" +
" <ParameterBinding Name=" + "\"dvt_sortfield\"" + " Location=" + "\"Postback;Connection\"" + "/>" +
" <ParameterBinding Name=" + "\"dvt_filterfields\"" + " Location=" + "\"Postback;Connection\"" + "/>" +
" <ParameterBinding Name=" + "\"dvt_partguid\"" + " Location=" + "\"Postback;Connection\"" + "/>";

Related

How to implement a interactive excel web addin with browser

I am implementing a excel web addin. I took a template project(excel web addin) using Visual Studio.
Here in code i need to call a URL. that will open in browser popup for login, after login it will have few events like user need to click allow access button. then it will navigate some other URL in same window. now i need to get that URL to my code.
I am able to call the URL and it is opening in browser. but after this i dont any object reference or context to control browser.
Below is the code i written.
SampleNav.js
var w = 800;
var h = 500;
var left = (screen.width / 2) - (w / 2);
var top = (screen.height / 2) - (h / 2);
var dialog = window.open("myurl", "window1", 'width=' + w + ',height=' + h + ',scrollbars=NO, top=' + top + ', left=' + left);
console.log("testDialog: " + window.location.pathname);
console.log("testDialog: " + window.location.hostname);
console.log("testDialog: " + window.location.assign);
console.log("testDialog: " + window.location.href);
console.log("testDialog: " + dialog.location.pathname);
console.log("testDialog: " + dialog.location.hostname);
console.log("testDialog: " + dialog.location.assign);
console.log("testDialog: " + dialog.location.href);
I tried to find something in dialog reference but no use
please suggest needful

search(query) throws NullPointerException

public List<DHProductLookupModel> findProductbyCCsapProductId(final String code)
{
final String queryString = "SELECT {p:" + DHProductLookupModel.SAPPRODUCTID + "}" + "FROM{" + DHProductLookupModel._TYPECODE
+ " AS p}" + "WHERE" + "{p:" + DHProductLookupModel.SAPPRODUCTID + "}=?code ";
final FlexibleSearchQuery query = new FlexibleSearchQuery(queryString);
query.addQueryParameter("code", code);
return flexibleSearchService.<DHProductLookupModel> search(query).getResult();
}
search(query) throws Null Pointer Exception, how to handle this?
Output:
Caused by: java.lang.NullPointerException
at de.hybris.platform.servicelayer.search.impl.DefaultFlexibleSearchService.getJaloResult(DefaultFlexibleSearchService.java:396) ~[coreserver.jar:?]
at de.hybris.platform.servicelayer.search.impl.DefaultFlexibleSearchService.search(DefaultFlexibleSearchService.java:168) ~[coreserver.jar:?]
at com.cancom.core.productlookup.dao.impl.CCProductLookupDaoImpl.findProductbyCCmanufacturerProductId(CCProductLookupDaoImpl.java:39) ~[classes/:?]
at com.cancom.core.productlookup.service.impl.CCProductLookupServiceImpl.getProductforCCmanufacturerProductId(CCProductLookupServiceImpl.java:37) ~[classes/:?]
Thanks!
Change your flexible search query from
final String queryString = "SELECT {p:" + DHProductLookupModel.SAPPRODUCTID + "}" + "FROM{" + DHProductLookupModel._TYPECODE
+ " AS p}" + "WHERE" + "{p:" + DHProductLookupModel.SAPPRODUCTID + "}=?code ";
to
final String queryString = "SELECT {p:" + DHProductLookupModel.PK + "}" + "FROM{" + DHProductLookupModel._TYPECODE
+ " AS p}" + "WHERE" + "{p:" + DHProductLookupModel.SAPPRODUCTID + "}=?code ";
You should send DHProductLookupModel.PK in search result.
In your case, you can use getModelsByExample of flexibleSearchService instead of writing the query.
Your method will be like
public List<DHProductLookupModel> findProductbyCCsapProductId(final String code)
{
DHProductLookupModel dhProductLookupModel = new DHProductLookupModel();
dhProductLookupModel.setSapProductID(code);
return getFlexibleSearchService().getModelsByExample(dhProductLookupModel);
}
find the example here
Thanks everyone!
I found the Problem. It was in my spring.I just had to put :
<context:component-scan base-package="myPackage"/>
I changed also the query with DHProductLookupModel.PK for safety. Now it´s work!

Embedded Docusign -Adding text tabs to Dynamic envelop without using template

I am unable to create Text tabs on a dynamic envelop created without a template. I am sending the PDf document as bytes to Docusign since I need to generate a unique envelop id for each recipient. I am able to generate a recipients view with the document specified. I am also able to add signHereTabs and dateSignedTabs but not the text tabs/first name tabs. There are few places in the document where the user needs to fill in the information using text boxes. Please help with a solution to add a text tab for guided signing.
The envelop definition is as follows:
"<envelopeDefinition xmlns=\"http://www.docusign.com/restapi\">" +
"<emailSubjectxxx</emailSubject>" +
"<status>sent</status>" +
"<documents>" +
"<document>" +
"<documentId>1</documentId>" +
"<name>" + documentName + "</name>" +
"</document>" +
"</documents>" +
"<recipients>" +
"<signers>" +
"<signer>" +
"<recipientId>1</recipientId>" +
"<email>" + recipientEmail + "</email>" +
"<name>" + recipientName + "</name>" +
"<clientUserId>1</clientUserId>" +
"<tabs>" +
"<signHereTabs>" +
"<signHere>" +
"<anchorString>By:</anchorString>" +
"<anchorXOffset>1</anchorXOffset>" +
"<anchorYOffset>0</anchorYOffset>" +
"<anchorIgnoreIfNotPresent>false</anchorIgnoreIfNotPresent>" +
"<anchorUnits>inches</anchorUnits>" +
"<documentId>1</documentId>" +
"<pageNumber>1</pageNumber>" +
"<recipientId>1</recipientId>" +
"</signHere>" +
"</signHereTabs>" +
"<dateSignedTabs>" +
"<dateSigned>" +
"<anchorString>(Date)</anchorString>" +
"<anchorXOffset>1</anchorXOffset>" +
"<anchorYOffset>-0.25</anchorYOffset>" +
"<anchorIgnoreIfNotPresent>false</anchorIgnoreIfNotPresent>" +
"<anchorUnits>inches</anchorUnits>" +
"<documentId>1</documentId>" +
"<pageNumber>1</pageNumber>" +
"<recipientId>1</recipientId>" +
"</dateSigned>" +
"</dateSignedTabs>" +
"<textTabs>" +
"<textTab>" +
"<tabLabel>Data Field 1</tabLabel>" +
"<locked>false</locked>" +
"<xPosition>200</xPosition>" +
"<yPosition>200</yPosition>" +
"<documentId>1</documentId>" +
"<pageNumber>1</pageNumber>" +
"<recipientId>1</recipientId>" +
"<name>Text</name>" +
"<required>true</required>" +
"<value>Text</value>" +
"</textTab>" +
"</textTabs>" +
"</tabs>" +
"</signer>" +
"</signers>" +
"</recipients>" +
"</envelopeDefinition>";
Thanks!
You need to change the inner xml element name to just <text> for each data tab you want. So change to this:
"<textTabs>" +
"<text>" +
...

Add tabs to show data that user can't change when signing in Docusign API by uploading pdf using api?

What code should i add in this in order to show a static text on document(like Amount charged, client name, company name etc) at some place that the user can't change at the time of signing the document and it should show up in the downloaded signed document from Docusign, i am using the request signature on document api walkthrough in this.
Thanks in advance.
string xmlBody =
"<envelopeDefinition xmlns=\"http://www.docusign.com/restapi\">" +
"<emailSubject>DocuSign API - Signature Request on Document</emailSubject>" +
"<status>sent</status>" + // "sent" to send immediately, "created" to save as draft in your account
// add document(s)
"<documents>" +
"<document>" +
"<documentId>1</documentId>" +
"<name>" + documentName + "</name>" +
"</document>" +
"</documents>" +
// add recipient(s)
"<recipients>" +
"<signers>" +
"<signer>" +
"<recipientId>1</recipientId>" +
"<email>" + recipientMail + "</email>" +
"<name>" + recipientName + "</name>" +
"<tabs>" +
//myTestCodeStart
"<tab>" +
"<DocumentID>1</DocumentID>" +
"<RecipientID>1</RecipientID>" +
"<PageNumber>1</PageNumber>" +
"<XPosition>100</XPosition>" +
"<YPosition>100</YPosition>" +
"<ScaleValue>1</ScaleValue>" +
"<Type>Custom</Type>" +
"<Name>TestName</Name>" +
"<TabLabel>LabelTest</TabLabel>" +
"<Value>TestValue</Value>" +
"<CustomTabType>Text</CustomTabType>" +
"<CustomTabWidth>42</CustomTabWidth>" +
"<CustomTabHeight>11</CustomTabHeight>" +
"<CustomTabRequired>true</CustomTabRequired>" +
"<CustomTabLocked>true</CustomTabLocked>" +
"<CustomTabDisableAutoSize>false</CustomTabDisableAutoSize>" +
"<CustomTabValidationPattern/>" +
"<CustomTabValidationMessage/>" +
"<RequireInitialOnSharedTabChange>false</RequireInitialOnSharedTabChange>" +
"<ConcealValueOnDocument>false</ConcealValueOnDocument>" +
"<Bold>false</Bold>" +
"<Italic>false</Italic>" +
"<Underline>false</Underline>" +
"</tab>" +
//myTestCodeEnd
"<signHereTabs>" +
"<signHere>" +
"<xPosition>350</xPosition>" + // default unit is pixels
"<yPosition>517</yPosition>" + // default unit is pixels
"<documentId>1</documentId>" +
"<pageNumber>1</pageNumber>" +
"</signHere>" +
"</signHereTabs>" +
"</tabs>" +
"</signer>" +
"</signers>" +
"</recipients>" +
"</envelopeDefinition>";
To make a tab value read-only in the Envelope, set the locked property to true for that tab.
<locked>true</locked>
For example, including this XML within a "Create Envelope" request would place the read-only text 123456 within the document (at the specified X/Y location):
<textTabs>
<textTab>
<tabLabel>AcctNumber</tabLabel>
<locked>false</locked>
<name>Account Number</name>
<value>123456</value>
<xPosition>100</xPosition>
<yPosition>200</yPosition>
<font>arial</font>
<fontSize>12</fontSize>
<documentId>1</documentId>
<pageNumber>1</pageNumber>
</textTab>
</textTabs>
(Your code shows you using <tab> -- which isn't a valid element name in the REST API. Seems like you should be using <textTabs> and <textTab> as I show in the exxample above.)

Populating share-point look up columns via the web service

I am trying to populate a look-up column in a list, via the web service.
I am getting my data from an asp.net web form and using the web service method UpdateListItems and sending batch XML.
However, unless the user enters the exact data that the look up uses, the web service returns an error.
Is there anyway i can give the user of the web form, similar look-up functionality in order that the data passed will be identical?
i'm using share point 2007
The data source for the look-up column in share point is active directory.
_x0028_HR_x0029__x0020_Partner is the look up column, entering the users login name will look up their full name/ you can pick from a list.
Your help is much appreciated.
ClasService.Lists NewStarterList = new ClasService.Lists();
NewStarterList.Credentials = new System.Net.NetworkCredential(ConfigurationManager.AppSettings["SPUserName"].ToString(),
ConfigurationManager.AppSettings["SPPassword"].ToString(), ConfigurationManager.AppSettings["SPDomain"].ToString());
NewStarterList.Url = ConfigurationManager.AppSettings["SPUrl"].ToString() + ConfigurationManager.AppSettings["SPServicePath"].ToString();
try
{
string strBatch = "<Method ID='1' Cmd='Update'>" +
"<Field Name='ID'>" + clasStarter.ClasID + "</Field>" +
"<Field Name='Title'>" + clasStarter.Name + "</Field>" +
"<Field Name='_x0028_HR_x0029__x0020_Job_x0020'>" + clasStarter.JobTitle + "</Field>" +
"<Field Name='Entity'>" + clasStarter.Entity + "</Field>" +
"<Field Name='Practice_x0020_Groups'>" + clasStarter.PracticeGroup + "</Field>" +
"<Field Name='Dept'>" + clasStarter.Department + "</Field>" +
"<Field Name='Physical_x0020_Desk_x0020_Locati'>" + clasStarter.Location + ", " + clasStarter.LocationInBuilding + ", " + clasStarter.Department + "</Field>" +
"<Field Name='_x0028_HR_x0029__x0020_Line_x002'>" + clasStarter.LineManager + "</Field>" +
"<Field Name='_x0028_HR_x0029__x0020_Buddy'>" + clasStarter.Buddy + "</Field>" +
"<Field Name='_x0028_HR_x0029__x0020_Partner'>" + clasStarter.Partner + "</Field>" +//is a look up
"</Method>";
XmlDocument xmlDoc = new System.Xml.XmlDocument();
System.Xml.XmlElement elBatch = xmlDoc.CreateElement("Batch");
elBatch.SetAttribute("OnError", "Continue");
elBatch.SetAttribute("ListVersion", "1");
elBatch.SetAttribute("ViewName", ConfigurationManager.AppSettings["SPViewID"].ToString());
elBatch.InnerXml = strBatch;
XmlNode ndReturn = NewStarterList.UpdateListItems(ConfigurationManager.AppSettings["SPListID"].ToString(), elBatch);
}
catch (Exception exp)
{
throw new Exception("NewStarterForm - Clas Update failed ", exp);
}
I haven't figured out a full solution my problem, but i have figured out part of it.
Share point look-up columns have two parts, an id and a value. If you don't know the value then you can just use -1;# as a substitute for the ID
an example of this is
"<Field Name='Partner'>-1;#" + partnerLogOnId + "</Field>"
I will probably use a list, that allows users of my form to select people, and will pass the partnerLogOnId to my web service method.

Resources