Setting a time as default value in gxt? - gxt

I realized I have this with all combo box. I want it to have a default value so I tried...
TimeField field = new TimeField();
field.setFormat(DateTimeFormat.getFormat("HH:mm"));
field.setRawValue("10:00");
But when I open the section, the value does not get set. It is still blank.

I m found the solution. I used following format its woks.
private TimeField fromTime = new TimeField();
fromTime.setFormat(DateTimeFormat.getFormat("HH:mm"));
fromTime.setIncrement(1);
Time time = new Time();
time.setText("00:00");
fromTime.setValue(time);
fromTime.setTriggerAction(TriggerAction.ALL);
toolbar.add(fromTime);

Related

Formula Field exception:The Tab formula is not valid

I am getting the exception Tab Formula for tab, t4 is invalid. Formula = [t2]+[t1]: Tag Label must be unique.
I have checkbox, a fundname and amount to invest in fund.
if user check the checkbox he need to fill the amount in amount box and there is total amount calculated based on the no of amount box has amount entered.
Evertything is working fine but only issue is with formula field. it is throwing an exception formula is invalid.
below is what I am using for showing the calculation:
var fullAnchor4 = new Tab
{
Type = TabTypeCode.Custom,
CustomTabType = CustomTabType.Formula,
CustomTabTypeSpecified = true,
AnchorTabItem =
new AnchorTab
{
AnchorTabString = "tbx4_1_text",
XOffset = -10,
YOffset = -5
},
CustomTabWidth = 100,
CustomTabWidthSpecified = true,
Formula = "<formula>[t2]+[t1]</formula>"
};
fullAnchor4.DocumentID = "1";
fullAnchor4.PageNumber = "1";
fullAnchor4.RecipientID = "1";
fullAnchor4.TabLabel = "t4";
fullAnchor4.RoundDecimalPlaces = 2;
runningList.Add(fullAnchor4);
is there something I am doing wrong?
EDIT--
Attached the raw request. removed sensitive info
http://wikisend.com/download/218254/RawRequest 1.txt
Per DocuSign's documentation, Formula Fields cannot be Anchored (link below). Unsure if this is still true today. Also, I noticed in your document you have the Formula Field's Anchor String listed twice. You have it also listed where an email address would be placed "Email Address: tbx4_1_text". Once I removed that duplicate string from the document the call was successful and the Formula Field appears to be calculating correctly.
https://www.docusign.com/support/classic/documentation/cdse-user-guide/advanced-sending/using-the-calculated-fields-feature
Your Formula value should not have XML tags in it. Your resulting API request looks like this:
<Formula><formula>[t2]+[t1]</formula></Formula>
You should use something like this:
Formula = "[t2]+[t1]"
The resulting XML will end up like this:
<Formula>[tw]+[t1]</Formula>

Opening excel file prompts a message box "content recovery of the workbook"

While I'm trying to open excel file a message box is prompting like "We found a problem with some content in file name. Do you want us to try to recover as much as we can? If you trust the source of this workbook, click Yes.". What actually done is i have a excel template designed and copying the file to another file and created temp file I'm inserting data to temp file using OPEN XML and data is getting from the database.
i have tried the solutions provided in the net but those fixes are not resolving my issue.My excel is 2010
Anyone solution provided is much appreciated.
I had this problem. It was caused by the way I was storing numbers and strings in cells.
Numbers can be stored simply using cell.CellValue = new CellValue("5"), but for non-numeric text, you need to insert the string in the SharedStringTable element and get the index of that string. Then change the data type of the cell to SharedString, and set the value of the cell to the index of the string in the SharedStringTable.
// Here is the text I want to add.
string text = "Non-numeric text.";
// Find the SharedStringTable element and append my text to it.
var sharedStringTable = document.WorkbookPart.GetPartsOfType<SharedStringTablePart>().First().SharedStringTable;
var item = sharedStringTable.AppendChild(new SharedStringItem(new Text(text)));
// Set the data type of the cell to SharedString.
cell.DataType = new EnumValue<CellValues>(CellValues.SharedString);
// Set the value of the cell to the index of the SharedStringItem.
cell.CellValue = new CellValue(item.ElementsBefore().Count().ToString());
This is explained in the documentation here: http://msdn.microsoft.com/en-us/library/office/cc861607.aspx
Another few cases that can cause this type of error:
Your sheet name is longer than 31 characters
You have invalid characters in sheet name
You have cells with values longer than 32k
The issue is due to using
package.Save();
and
package.GetAsByteArray();
at the same time
when we call
package.GetAsByteArray();
it will do following operations
this.Workbook.Save();
this._package.Close();
this._package.Save(this._stream);
Hence, removing
package.Save();
will solve this problem "We found a problem with some content in file name. Do you want us to try to recover as much as we can? If you trust the source of this workbook, click Yes."
Another possible cause could be exceeded maximum number of cell styles.
You can define:
up to 4000 styles in a .xls workbook
up to 64000 styles in a .xlsx workbook
In this case you should re-use the same cell style for multiple cells, instead of creating a new cell style for every cell.
I added the right cellReference and fixed this issue for me:
string alpha = "ABCDEFGHIJKLMNOPQRSTUVQXYZ";
for (int colInx = 0; colInx < reader.FieldCount; colInx++)
{
AppendTextCell(alpha[colInx] + "1", reader.GetName(colInx), headerRow);
}
private static void AppendTextCell(string cellReference, string cellStringValue, Row excelRow)
{
// Add a new Excel Cell to our Row
Cell cell = new Cell() { CellReference = cellReference, DataType = new EnumValue<CellValues>(CellValues.String) };
CellValue cellValue = new CellValue();
cellValue.Text = cellStringValue.ToString();
cell.Append(cellValue);
excelRow.Append(cell);
}
Same warning but the problem with me was that I was using a client input (name of wave) as sheet name for the file and when date was presented within the name, the character '/' used as date part separator was causing the issue.
I think Microsoft need to provide a better error log to save people time investigate such minor issues. Hope my answer will save someone else's time.
The issue was due to storing a string in the cell directly using cell.CellValue = new CellValue("Text"). It is possible to store numbers like this but not string. For string, define data type as string before assigning the text using Cell.DataType = CellValues.String;

XPages date only fieldonly

Is it possible to create a date only field in XPages? I have tried the following in the querySaveDocument event but the field still ends up with a time portion of 00:00:00
var notesDoc:NotesDocument = document1.getDocument();
var dt:NotesDateTime = session.createDateTime(#Today());
dt.setAnyTime();
notesDoc.replaceItemValue("MyDateField", dt);
It is not completely clear what you are trying achieve.
You can put an EditBox component on your XPage, then go to the "Data" tab. From there you can change the formatting from String to Date. More options should appear on how to format the date in the field. It will handle passing the date to the back end document.
If it is you want to write directly to the back end document, then here is a page listing samples on working with NotesDateTime.
http://www-10.lotus.com/ldd/ddwiki.nsf/dx/NotesDateTime_sample_JavaScript_code_for_XPages
Here is code by Sven:
ndt = session.createDateTime(ndt.getDateOnly());
item.setDateTimeValue(ndt);
error in date items, daylight Saving
Update:
I had to do the same thing and found out that it's working this way in Java agent in 8.5.2FP3:
DateTime dt = session.createDateTime(new java.util.Date());
dt.setAnyTime();
doc.appendItemValue("DT", dt);

ColumnCount in DataGridView remains 0 after assigning data source

I am having trouble with the following simple code
BindingList<Car> tempList = new BindingList<Car>();
BindingSource bindingSource = new BindingSource();
bindingSource.DataSource = tempList;
dgTempView.DataSource = bindingSource;
Here, dgTempView is a data grid view
After the above lines execute, the column count in the datagrid view remains 0. And when I try adding a Car instance in tempList, I get an error saying that 'no row can be added to a datagridview control that does not have columns' . I am not able to understand what am I missing here
Found my mistake. The members of the Class Car were public instance variables and not properties. The moment I changed them to Auto Properties it worked :)

Setting DisplayMemberPath of ComboBox in code

In my WPF program I have:
string queryString = "Select AccountID, ProjectName from Foo where IsEnabled = 1";
SqlDataAdapter adapter = new SqlDataAdapter(queryString, sConn1);
DataSet dsAccounts = new DataSet();
adapter.Fill(dsAccounts, "Accounts");
cbAccount.ItemsSource = dsAccounts.Tables["Accounts"].AsEnumerable();
cbAccount.DisplayMemberPath = "ProjectName";
When my program runs and I dropdown the ComboBox all the rows are there but they display as blanks. When I click on a row, my SelectionChanged event handler properly identifies the selected row and picks up the proper values.
I believe my problem is with the DisplayMemberPath.
What am I doing wrong?
This is not an answer but rather a workaround. This works:
cbAccount.DataContext = dsAccounts.Tables["Accounts"];
//cbAccount.ItemsSource = dsAccounts.Tables["Accounts"].AsEnumerable();
cbAccount.DisplayMemberPath = "ProjectName";
By setting the DataContext reather than the ItemSource then the DisplayMemberPath is being set properly.
The question remains open, there must be a way to properly set the DisplayMemberPath when one has an ItemSource rather than a DataContext.
I believe the problem is that your table accounts is not serialized to objects.
If you use a list of accounts instead of your tables then it works perfect with the ItemsSource and DisplayMemeberPath.

Resources