Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 3212

Anyone knows how to use Smartform?

$
0
0

I have no luck using Smartform.  If I just use the smart control without the form, everything works, but if I use smart form, boom nothing.  Am I missing something here?

 

        <smartForm:SmartForm

            id="quickCreateForm"

            title="Sales Order - Quick Create"

       editTogglable="true">

 

            <smartForm:Grouplabel="Sales Order Information">

            <smartForm:GroupElement>

                 <smart:SmartFieldvalue="{CustomerID}"/>

                 </smartForm:GroupElement>

            </smartForm:Group>

            </smartForm:SmartForm> 


controller:


        onInit: function() {

                this._oView = this.getView();

//              var oItemTemplate = this.byId("columnListItem").clone();

                this._oComponent = sap.ui.component(sap.ui.core.Component.getOwnerIdFor(this._oView));

                this._oResourceBundle = this._oComponent.getModel("i18n").getResourceBundle();

                this._oRouter = this._oComponent.getRouter();

//              this._oCatalog = this.byId("catalogTable");

 

//              this._initViewPropertiesModel();

 

        var sServiceURL = "/sap/opu/odata/sap/ZMNEMONIC_SO_CREATE_SRV";

       

        var sEntityName = "/SalesOrder";

 

        var oModel = new sap.ui.model.odata.v2.ODataModel(sServiceURL);

        oModel.setDefaultBindingMode(sap.ui.model.BindingMode.TwoWay);     

        oModel.setUseBatch(true);

        var oMetaModel = oModel.getMetaModel();

        oMetaModel.loaded().then($.proxy(function () { 

                this.getView().setModel(oModel);

                var oType = oMetaModel.getODataEntityType("ZMNEMONIC_SO_CREATE_SRV.SalesOrder");

//           var oMetaContext = oMetaModel.getMetaContext("/" + sEntityName +"s");

//           

//           var oData = {item:obj, showFooter:false};

//          

//         // For the XML template we need to set preprocessors information.

//          oData.view = new sap.ui.xmlview({

//                preprocessors: {

//                    xml: {

//                      bindingContexts: {

//                        meta: oMetaContext

//                      },

//                      models: {

//                        meta: oMetaModel

//                      }

//                    }

//                  },

//               type : sap.ui.core.mvc.ViewType.XML,

//               viewName : 'sap.mnemonic.view.QuickDisplaySmartTemplate'

//            });

//            oData.view.setModel(oModel);

//           

//            oData.view.getController().initialize(oType, false);

//              this.getView().bindElement(sEntityName +"s");

                var oEntry = oModel.createEntry(sEntityName + "s");

                this.getView().setBindingContext(oEntry);

               

//                this.getView().byId("quickCreateForm").setModel(oModel);

//                this.getView().byId("quickCreateForm").setBindingContext(oEntry);

               

        }, this));


Viewing all articles
Browse latest Browse all 3212

Trending Articles