I have a custom field derived from SPTextField displays EntityEditorWithPicker while in New or Edit mode (I have extended my class from EntityEditorWithPicker). I have added that field as column to a list. When I select any item from the Dialog, it adds that item to the list column. Fine till here. Fine upto this point.
But when I go to Edit any item in the list, it shows the EntityEditorWithPicker on the edit item page but textfield is empty. I want that the value in the list should appear in the textfield in the EntityEditorWithPicker. How can I achieve that.
Thanks in davance for the help.
Best regards,
Asher
We have UpdateEntities() method in EntityEditorWithPicker class (Please note that we need to extend this class for use in our code) that accepts the object of ArrayList. Create EntityPicker Object, populate the Key property (Key property will appear in the Textbox as you want), add EntityPicker object in ArrayList Object and then pass ArrayList Object to UpdateEntities() method. We are done!!!
MyExtendedEntityEditorWithPicker _recordPicker = new MyExtendedEntityEditorWithPicker();
ArrayList entities=new ArrayList();
EntityPicker entity=new EntityPicker();
entity.Key="Value To be Displayed in Textbox";
entities.Add(entity);
_recordPicker.UpdateEntities(entities);
I hope this helps!
Azher Iqbal
Related
I have an array with different properties. The title property will be duplicated but the other properties in that item will not. I need to display the title property in a table however only if they are not duplicates.
my code below
data-bind="id: 'criteria_category_item_' + Criteria_Category_ID, text: Criteria_Title"
the above will display text for all titles even if they already exist so i now have duplicates in my table.
How would i do this in a foreach ?
there is no data-bind="id
you probably look for attr-binding:
data-bind="attr:{id: ...},text: ..."
When trying to retrieve DocumentPageTitle and DocumentPageDescription using GetStringValue() on a custom page type TreeNode, the result is always coming back as the default value (in this case an empty string) passed into the method.
I'm able to successfully retrieve other column values as well as standard document properties such as DocumentName, DocumentID and AbsoluteURL, but not the document meta properties.
The respective fields in the Meta tab of document/page do have values and are being successfully rendered in the by default such as <meta name="description" content=".." />
// returns empty string
string documentPageDescription = DocumentContext.CurrentDocument.GetString("DocumentPageDescription", string.Empty);
// returns empty string
TreeNode document = parameters[0] as TreeNode;
string documentPageDescription = document.GetStringValue("DocumentPageDescription", string.Empty);
I've tried setting option Inherits fields from page type to "Page (menu item)", but that did not help.
Does the custom page type need to inherit from something specifically or have a specific setting activated to access these values? Or if what I think is a TreeNode in fact isn't, how could I get the TreeNode from this object that has the properties listed before available?
Thank you for any help you can provide.
ValidationHelper.GetString(CMS.DocumentEngine.DocumentContext.CurrentDocument.GetValue("DocumentPageDescription"), string.Empty)
Two things to check, one, are you sure the meta data is available on the page you are pulling? Two, is your API actually pulling all the data for that page?
I've used these in my test and both returned the metadata.
var page = DocumentHelper.GetDocuments().Path("/Articles/Coffee-Beverages-Explained").FirstObject;
Response.Write(page.GetStringValue("DocumentPageDescription", string.Empty));
TreeProvider tree = new TreeProvider(MembershipContext.AuthenticatedUser);
TreeNode tn = tree.SelectNodes().OnCurrentSite().Path("/Articles/Coffee-Beverages-Explained").FirstObject;
Response.Write(tn.GetStringValue("DocumentPageDescription", string.Empty));
The DocumentPageTitle and DocumentPageDescription were coming back as null when the custom page type document/page was inheriting from parent/global values.
I was able to use the following to get the properties when not inheriting, while falling back to the parent value when inheriting was taking place:
string documentPageTitle = document.GetStringValue("DocumentPageTitle", DocumentContext.CurrentTitle);
This approach came from the following issue on Kentico DevNet.
Thank you for your help and suggestions, it's appreciated.
I have the following inputText field in MAF.
< amx:inputText value="#{bindings.searchCivilID.inputValue}" label="civil id" id = "it1">
The setter setSearchCivilID() is called each time when i change the text in the field. (like - from "1" to "12").
But when I try to delete the text or totally remove the text , the setter method is not called and hence the previous value is retained in the property.
Can you guys help me out in this?
Thanks,
Haleem.
Tick the check box:" Notify listeners when property changes" while generating generating get() and set() . so when the value of the field changes it will fire the method propertyChangeSupport.firePropertyChange("<your_variable_name>",oldValue,newValue)
I would like to find the index of an item inside a GWT Listbox by specifying a String value.
For example, if I had a GWT ListBox comprising the following items: "Randy", "Bob" and "Helen", the method i'm looking to implement would return the value 1 if I called it with parameter "Bob".
From what i'm seeing in the ListBox javadoc, ther does not seem to be any quick method to do this.
Any ideas?
Thanks in advance!
My idea of implementation as TextBox doesn't provide this out of the box. Store all the items in a list and in the order you want them to be part of ListBox.
List<String> orderedItems=new ArrayList<String>
orderedItems.add(0,"Randy");
orderedItems.add(1,"Bob");
orderedItems.add(2,"Helen");
//adding items in the same order as they are in List is the key
for(String item:items)
{
lb.addItem(item);
}
then you can find the index using List's indexOf(..) method
I wound up modifying the source from a publically posted POC: http://datacogs.com/datablogs/archive/2007/08/26/641.aspx, which is a custom field definition for cascading drop downs. The modifications were to allow parent-child list boxes where a user can multiselect for filtering and selecting the values to be written back to a SharePoint list. I got the parent-child cascading behavior working, but the save operation only takes the first value that is selected from the list box. I changed the base type for the custom field control from "SPFieldText" to "SPMultiLineText", along with changing the FLD_TYPES field definition values from:
Text to Note and this did not work. So, I changed the field control base type to "SPFieldMultiChoice" and the FLD_TYPES to "MultiChoice" and still get the same result, which is only the first value that's selected, writing to the SharePoint list.
Does anyone have any idea how to get a custom field with multiple selections to write those multiple selections to a SharePoint list?
Thanks for taking the time to read through my post.
Cheers,
~Peter
I was able to accomplish this by inheriting from SPFieldLookup and overriding its internal handling of AllowMultipleValues:
In your FLDTYPES_*.xml set <ParentType>LookupMulti</ParentType>
In your extension of SPFieldLookup, be sure to override AllowMultipleValues (always true), FieldValueType (probably typeof(SPFieldLookupValueCollection)) and FieldRenderingControl. I also set base.LookupField = "LinkTitleNoMenu", though in retrospect I'm not sure why. :)
In your field editor control's OnSaveChange(), set the field's Mult value to true.
To set Mult, you can either string manipulation on field.SchemaXml:
string s = field.SchemaXml;
if (s.IndexOf(" Mult=", StringComparison.OrdinalIgnoreCase) < 0)
field.SchemaXml = s.Insert(s.IndexOf("/>", StringComparison.Ordinal), " Mult=\"TRUE\" ");
Or use reflection:
var type = field.GetType();
var mi = type.GetMethod("SetFieldBoolValue", BindingFlags.Instance | BindingFlags.NonPublic);
mi.Invoke(field, new object[] { "Mult", true });
It's been a while, so I might be forgetting something, but that should be most of it.