Custom Data List
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-23-2011 10:54 AM
I am very new to Alfresco. I have installed Alfresco Community v3.4.0 on Windows platform and and it's working well.
I need to create some custom lists. I saw some posts, but I am not 100% clear. Are there any step by step instructions on how to go about it? I saw mention of Eclipse on YouTube, but not sure where to find it and which Eclipse tool I need to use.
Any help?
Thanks
Parag Bhalerao
- Labels:
-
Archive

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2011 10:30 AM
I created a list "General correspondence"
First I create a file "gcDatalistModel.xml" in the folder "C:\Alfresco\tomcat\shared\classes\alfresco\extension\"
This is the file that will hold my model (data list) definition
The file has the following content:
<?xml version="1.0" encoding="UTF-8"?><!– Definition of new Model –><model name="gc:gcDatalist" xmlns="http://www.alfresco.org/model/dictionary/1.0"> <!– Optional meta-data about the model –> <description>Custom Bhukka datalist</description> <author>Eugene vRvOudtshoorn</author> <version>1.0</version> <!– Imports are required to allow references to definitions in other models –> <imports> <!– Import Alfresco Dictionary Definitions –> <import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/> <!– Import Alfresco Content Domain Model Definitions –> <import uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/> <!– Import Alfresco Data List Model Definitions –> <import uri="http://www.alfresco.org/model/datalist/1.0" prefix="dl"/> </imports> <!– Introduction of new namespaces defined by this model –> <namespaces> <namespace uri="gc.customlists.com" prefix="gc"/> </namespaces> <!– T Y P E D E F I N I T I O N S –> <types> <!– Data list defintions For this model go here –> <type name="gc:generalCor"> <title>General correspondence</title> <description>General correspondence</description> <parent>dl:dataListItem</parent> <properties> <property name="gc:gcID"> <title>GC number</title> <type>d:text</type> <mandatory>true</mandatory> </property> <property name="gc:gcIDclient"> <title>Client ref number</title> <type>d:text</type> <mandatory>false</mandatory> </property> <property name="gc:gcTitle"> <title>Title</title> <type>d:text</type> <mandatory>true</mandatory> </property> <property name="gc:gcComments"> <title>Comments</title> <type>d:text</type> <mandatory>false</mandatory> </property> <property name="gc:gcRefCor"> <title>Ref correspondence</title> <type>d:text</type> <mandatory>false</mandatory> </property> </properties> <associations> <association name="gc:gcAttachments"> <title>Attachements</title> <source> <mandatory>false</mandatory> <many>true</many> </source> <target> <class>cm:content</class> <mandatory>false</mandatory> <many>true</many> </target> </association> </associations> </type> </types> </model>
The way it works is as follows:
<model name="gc:gcDatalist" xmlns="http://www.alfresco.org/model/dictionary/1.0">
You give your new model a name in the bold section. It can be anything as long as it has a prefix "gc" followed by ":" and then a name "gcDatalist"
The import section attaches other models so that your model can be build as a child using definitions already set in these models
<imports> <!– Import Alfresco Dictionary Definitions –> <import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/> <!– Import Alfresco Content Domain Model Definitions –> <import uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/> <!– Import Alfresco Data List Model Definitions –> <import uri="http://www.alfresco.org/model/datalist/1.0" prefix="dl"/> </imports>
The name space section is used to set a uri and prefix for the model. The uri can be anything
<namespace uri="gc.customlists.com" prefix="gc"/>
Now we define a model type with properties and associations (data list name with columns)
<types> <!– Data list defintions For this model go here –> <type name="gc:generalCor"> <title>General correspondence</title> <description>General correspondence</description> <parent>dl:dataListItem</parent> <properties> <property name="gc:gcID"> <title>GC number</title> <type>d:text</type> <mandatory>true</mandatory> </property> <property name="gc:gcIDclient"> <title>Client ref number</title> <type>d:text</type> <mandatory>false</mandatory> </property> <property name="gc:gcTitle"> <title>Title</title> <type>d:text</type> <mandatory>true</mandatory> </property> <property name="gc:gcComments"> <title>Comments</title> <type>d:text</type> <mandatory>false</mandatory> </property> <property name="gc:gcRefCor"> <title>Ref correspondence</title> <type>d:text</type> <mandatory>false</mandatory> </property> </properties> <associations> <association name="gc:gcAttachments"> <title>Attachements</title> <source> <mandatory>false</mandatory> <many>true</many> </source> <target> <class>cm:content</class> <mandatory>false</mandatory> <many>true</many> </target> </association> </associations> </type> </types>
As i stated the properties and associations are your columns in the datalist. I think this section is easy to understand. The associations allow you to attach files the the list.
The model is now defined and we now have to tell share what to display when
Open the file "share-config-custom.xml" located in "C:\Alfresco\tomcat\shared\classes\alfresco\web-extension\"
Scroll to the bottom of the file and insert the following code (insert before the close of the file </alfresco-config>)
<!– General correspondence –> <config evaluator="model-type" condition="gc:generalCor"> <forms> <!– Create item form –> <form> <field-visibility> <!– for the form creation we are showing everything except approved date –> <show id="gc:gcID" /> <show id="gc:gcIDclient" /> <show id="gc:gcTitle" /> <show id="gc:gcComments" /> <show id="gc:gcAttachments" /> </field-visibility> <create-form template="/org/alfresco/components/data-lists/forms/dataitem.ftl" /> <appearance> <field id="gc:gcIDclient"> <control template="/org/alfresco/components/form/controls/textarea.ftl" /> </field> <field id="gc:gcComments"> <control template="/org/alfresco/components/form/controls/textarea.ftl" /> </field> <field id="gc:gcAttachments"> <control> <control-param name="startLocation">{doclib}</control-param> </control> </field> </appearance> </form> <!– Data Grid view –> <form id="datagrid"> <field-visibility> <show id="gc:gcID" /> <show id="gc:gcIDclient" /> <show id="gc:gcTitle" /> <show id="gc:gcComments" /> <show id="gc:gcAttachments" /> </field-visibility> </form> </forms> </config> <!– Edit view –> <config evaluator="node-type" condition="gc:generalCor"> <forms> <!– Edit marketing item form –> <form> <field-visibility> <show id="gc:gcID" /> <show id="gc:gcIDclient" /> <show id="gc:gcTitle" /> <show id="gc:gcComments" /> <show id="gc:gcAttachments" /> </field-visibility> <create-form template="/org/alfresco/components/data-lists/forms/dataitem.ftl" /> <appearance> <field id="gc:gcIDclient"> <control template="/org/alfresco/components/form/controls/textarea.ftl" /> </field> <field id="gc:gcComments"> <control template="/org/alfresco/components/form/controls/textarea.ftl" /> </field> <field id="gc:gcAttachments"> <control> <control-param name="startLocation">{doclib}</control-param> </control> </field> </appearance> </form> </forms> </config>
The code works as follows:
The section "<config evaluator="model-type" condition="gc:generalCor">" is were you tell share the datalist under discussion. This is not your model name but your type name
<!– Create item form –> <form> <field-visibility> <!– for the form creation we are showing everything except approved date –> <show id="gc:gcID" /> <show id="gc:gcIDclient" /> <show id="gc:gcTitle" /> <show id="gc:gcComments" /> <show id="gc:gcAttachments" /> </field-visibility> <create-form template="/org/alfresco/components/data-lists/forms/dataitem.ftl" /> <appearance> <field id="gc:gcIDclient"> <control template="/org/alfresco/components/form/controls/textarea.ftl" /> </field> <field id="gc:gcComments"> <control template="/org/alfresco/components/form/controls/textarea.ftl" /> </field> <field id="gc:gcAttachments"> <control> <control-param name="startLocation">{doclib}</control-param> </control> </field> </appearance> </form>
This section is were you indicate which properties and associations are to be displayed when you create the datalist
<!– Data Grid view –> <form id="datagrid"> <field-visibility> <show id="gc:gcID" /> <show id="gc:gcIDclient" /> <show id="gc:gcTitle" /> <show id="gc:gcComments" /> <show id="gc:gcAttachments" /> </field-visibility> </form>
Here you define the columns to display
<!– Edit view –> <config evaluator="node-type" condition="gc:generalCor"> <forms> <!– Edit marketing item form –> <form> <field-visibility> <show id="gc:gcID" /> <show id="gc:gcIDclient" /> <show id="gc:gcTitle" /> <show id="gc:gcComments" /> <show id="gc:gcAttachments" /> </field-visibility> <create-form template="/org/alfresco/components/data-lists/forms/dataitem.ftl" /> <appearance> <field id="gc:gcIDclient"> <control template="/org/alfresco/components/form/controls/textarea.ftl" /> </field> <field id="gc:gcComments"> <control template="/org/alfresco/components/form/controls/textarea.ftl" /> </field> <field id="gc:gcAttachments"> <control> <control-param name="startLocation">{doclib}</control-param> </control> </field> </appearance> </form> </forms> </config>
Here you define the items to display when you edit the data list
Now share knows what to display when. Next you have to create a file named "CustomDatalist-model-context.xml" the name is not important as long as you end the file with "-context.xml"
Store the file in "C:\Alfresco\tomcat\shared\classes\alfresco\extension\"
Add in the file the following
<?xml version='1.0' encoding='UTF-8'?><!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'><beans> <!– Registration of new models –> <bean id="extension.gc.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap"> <property name="models"> <list> <value>alfresco/extension/gcDatalistModel.xml</value> </list> </property> </bean><bean id="extension.mtg.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap"> <property name="models"> <list> <value>alfresco/extension/mtgDatalistModel.xml</value> </list> </property> </bean></beans>
I included a second model to demonstrate how you can load other models later on. but for this demo the important section is
<bean id="extension.gc.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap"> <property name="models"> <list> <value>alfresco/extension/gcDatalistModel.xml</value> </list> </property> </bean>
With all the files in place you can now restart the server and it will load your new data lists

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2016 06:22 AM
can u help me pls...
while clicking attachments select button in adding new item in custom data list, I want to add files from windows explorer in client side instead of from server.
abve image is adding attachments from server i dont want that, i want to add files from windows explorer in client pc.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2011 04:33 PM
By the way, do you know how to arrange the columns in a desired order? When I was able to dynamically add the gcDatalistModel.xml directly into Alfresco via repository/data dictionary/models and making the content active, everything worked fine. So I made my own data list model but when I went to use it, the columns were all over the place. No rhyme or reason to it. After uploading edited xmls, the data lists seemed to become unstable as I could not do anything; couldn't delete the xmls, deactivate them, they would only randomly show up as an option for a new list after refreshing the page several times. When attempting to upload I got some wild errors in catalina.out file. So I haven't been able to figure anything out. I've re-installed Alfresco several times. It works with the very first upload of the xml but starts to throw out errors very soon after that.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-29-2011 12:27 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2012 11:11 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2012 09:58 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2012 05:25 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2012 05:42 PM
2012-04-25 11:39:19,431 ERROR [web.context.ContextLoader] [Thread-1] Context initialization failed
org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'extension.gc.dictionaryBootstrap' defined in file [C:\Alfresco\tomcat\shared\classes\alfresco\web-extension\CustomDatalist-model-context.xml]: Could not resolve parent bean definition 'dictionaryModelBootstrap'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'dictionaryModelBootstrap' is defined.
Any Ideas as to whats wrong?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-01-2012 01:43 PM
–
Chris
