Module Builder backend "Choice" Field
This field is broken on the backend
1) The screen where you choose which columns are in the list is showing description not title
2) So dragging that into the grid results in an insane length column header
3) When items are imported (using the code snippit) but not "Published" they have "Option" appened to their type name oddly. We imported them unpublished so the content editor could go though 1 by 1 and categorize and publish...so she knows she hasn't done something yet by its current published state.
4) So reading #3, we can't filter on UnPublished
Hi Steve,
Thank you for contacting us.
About your first question the column names are the same as the labels for your fields. Choices fields have got only labels that could be longer because they might be questions or sentences. However your issue has a very simple workaround. What you need to do is to navigate to Administration -> Settings -> Advanced -> ContentView -> Controls -> YourCustomContentType -> Views -> ContentTypeBackendList -> View Modules -> Grid -> Columns -> YourColumnName -> Change "HeaderText" property the way you want it -> Save. You might need to recycle your app pool or restart your server.
As I see from your screenshot you haven't assigned any status to your content items and that's why you can't filter them on "UnPublished". Here is how you should set your items as unpublished:
DynamicModuleManager dynamicModuleManager = DynamicModuleManager.GetManager();
Type sampleContentType = TypeResolutionService.ResolveType(
"Telerik.Sitefinity.DynamicTypes.Model.SampleModule.SampleContent"
);
DynamicContent sampleContentItem = dynamicModuleManager.CreateDataItem(sampleContentType);
// This is how values for the properties are set
sampleContentItem.SetValue(
"Title"
,
"Some Title"
);
sampleContentItem.SetValue(
"Owner"
, SecurityManager.GetCurrentUserId());
sampleContentItem.SetValue(
"PublicationDate"
, DateTime.Now);
// Set the selected value
sampleContentItem.SetValue(
"Choice"
,
new
string
[]
"First Choice"
,
"Second Choice"
);
//Setting the URL name
sampleContentItem.UrlName =
"some-title"
;
dynamicModuleManager.Lifecycle.Publish(sampleContentItem);
dynamicModuleManager.SaveChanges();
//Saving the item as published
WorkflowManager.MessageWorkflow(sampleContentItem.Id, sampleContentType,
null
,
"Publish"
,
false
,
new
Dictionary<
string
,
string
>());
//Saving the item as unpublished
WorkflowManager.MessageWorkflow(sampleContentItem.Id, sampleContentType,
null
,
"Unpublish"
,
false
,
new
Dictionary<
string
,
string
>());
//Filtering items with status "Unpublished"
var items = dynamicModuleManager.GetDataItems(sampleContentType).Where(i => i.ApprovalWorkflowState ==
"Unpublished"
);
DynamicModuleManager dynamicModuleManager = DynamicModuleManager.GetManager();
Type sampleContentType = TypeResolutionService.ResolveType(
"Telerik.Sitefinity.DynamicTypes.Model.SampleModule.SampleContent"
);
DynamicContent sampleContentItem = dynamicModuleManager.CreateDataItem(sampleContentType);
// This is how values for the properties are set
sampleContentItem.SetValue(
"Title"
,
"Some Title"
);
sampleContentItem.SetValue(
"Owner"
, SecurityManager.GetCurrentUserId());
sampleContentItem.SetValue(
"PublicationDate"
, DateTime.Now);
// Set the selected value
sampleContentItem.SetValue(
"Choice"
,
new
string
[]
"First Choice"
,
"Second Choice"
);
//Setting the URL name
sampleContentItem.UrlName =
"some-title"
;
//This will set that the item is saved as draft
sampleContentItem.ApprovalWorkflowState =
"Draft"
;
dynamicModuleManager.SaveChanges();
//Filtering items with status "Draft"
var items = dynamicModuleManager.GetDataItems(sampleContentType).Where(i => i.ApprovalWorkflowState ==
"Draft"
);
sampleContentItem.SetValue(
"Choice"
,
new
string
[]
"First Choice"
,
"Second Choice"
);