Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 3354

Re: not able to use a fragment twice in a same view

$
0
0

Hi Experts,

 

 

i am trying to destroy the SelectDialog by calling it's Id and destroying it. but when i am trying to create the same SelectDialog box but it is showing an error message

 

cancel:function(){

sap.ui.getCore().byId("__dialog0").destroy();

}

 

 

 

the SelectDialog is Created as follows:

 

  onSelectDialog: function(oModel, oControl, oColumnArray,oTableParam) {

               

            if (!oControl.oFragment) {

 

            oControl.oFragment = sap.ui.jsfragment("Ganesh.DemoFragment", this);

 

            var oMetaData = oModel.getServiceMetadata();

            var oEntityRef = oMetaData.dataServices.schema[0].entityType[0];

            var oListProperties = oEntityRef.property;

            var oLength = oListProperties.length;

            for (var i = 0; i < oLength; i++) {

                oControl.oFragment.addItem(new sap.m.InputListItem({

                    label: oListProperties[i].name,

                }));

            }

            var oListArray=[];

            var oListIdsArray=[];

            var oListItemsCount=oControl.oFragment.getItems().length;

            for(var a=0;a<oListItemsCount;a++){

                var oListIds=oControl.oFragment.getItems()[a].sId;

                oListIdsArray.push(oListIds);

                var oListNames=sap.ui.getCore().byId(oListIds).mProperties.label;

                oListArray.push(oListNames);

            }

           

            for (i = 0; i < oListArray.length; i++) {

                var oItemName = oListArray[i];

 

                for (j = 0; j < oColumnArray.length; j++) {

                    var oColumnName = oColumnArray[j];

                    if (oItemName == oColumnName) {

                        sap.ui.getCore().byId(oListIdsArray[i]).setSelected(true);

                        ///  console.log(oIDArray[i]);

                    }

                }

            }

 

        } else {

            oControl.getView().addDependent(oControl.oFragment);

        }

        oControl.oFragment.open();

       

       //return  oControl.oFragment;

        //console.log(oTableParam);

    },

 

 

as i am thinking the (oControl.oFragment) is stored with value 1 and it is not able to create another SelectDialog ..

 

How can we overcome this please help me..

 

Regards,

Ganesh.


Viewing all articles
Browse latest Browse all 3354

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>