Creating Custom Widgets

0
I have created a custom widget following basic Tutorial provided in a documentation. I have files named: --------------------------------------------------------------------------- package.xml --------------------------------------------------------------------------- <?xml version="1.0" encoding="utf-8" ?> <package xmlns="http://www.mendix.com/package/1.0/"> <clientModule name="BasicWidget" version="0.1" xmlns="http://www.mendix.com/clientModule/1.0/"> <widgetFiles> <widgetFile path="custom/BasicWidget.xml"/> </widgetFiles> <files> <file path="custom/"/> </files> </clientModule> </package> --------------------------------------------------------------------------- BasicWidget.js --------------------------------------------------------------------------- dojo.provide("custom.BasicWidget"); mendix.widget.declare("custom.BasicWidget",{ addons : null, inputargs : { string : '' }, postCreate : function(){ this.sayHello(); this.actRendered(); }, sayHello : function(){ this.domNode.innerHTML = this.string; }, uninitialize : function(){ } }); --------------------------------------------------------------------------- BasicWidget.xml --------------------------------------------------------------------------- <?xml version="1.0" encoding="utf-8" ?> <widget id="custom.BasicWidget" needsEntityContext="false" xmlns="http://www.mendix.com/widget/1.0/"> <name>Basic Widget Development</name> <description>Welcome To The New Widget</description> <properties> <property key="string" type="string"> <caption>String to use</caption> <category>Common</category> <description>The string to use.</description> </property> </properties> </widget> --------------------------------------------------------------------------------------------- I keep getting this error : Package 'C:\Users\gmp\Documents\Source\BookingDemo-main_2\widgets\custom.mpk': Client module specifies file path 'custom/' that does not exist in the package. I would also like to know how I zip them together. Do I create a folder and put them inside to create a Zip file or Do I highlight them and send them to Zip Folder?
asked
2 answers
1

Hi George,

Take a look at another, existing widget. You can unzip them, they are archive files. Then you see what the structure is.

answered
1

I would also like to know how I zip them together. Do I create a folder and put them inside to create a Zip file or Do I highlight them and send them to Zip Folder?

That is correct you select both files and add them to a zip folder which should have the same name as the client module, also after zipping the file you have to rename it to .mpk

Also note that you need atleast one directory inside your widget named exactly the same as the client module. Thus in your case you would have the following structure:

--custom.mpk
  |--package.xml
  |--custom
     |--BasicWidget.js
     |--BasicWidget.xml
answered