cancel
Showing results for 
Search instead for 
Did you mean: 

SAP MDK bind data to the List picker control from the rule

learner1
Explorer
0 Kudos
1,130

Hi Experts, @bill_froelich 

I am trying to call the OData from the Rule and bind the results to List Picker control. Rule is executing when the page is loaded and  getting the error as no Data providers exists, it's due to the Page is loaded before the Service is initialized. Now I am calling the OData services after the Success Action of the InitializeOnline.action and setting the data to the ListPicker using the setPickerItems(items). 

But this is making the list screen hanging as the screen is loading all the records that are set using setPickerItems method and no paging working here. I don't want to bind the entityset as a target to the list picker as I want to use the search functionality and filter the values within the list picker results screen without making an Odata call again when I type a text. 

Is there any option to call the OData after the click of ListPicker, store all the records from the response in client data and bind the string collection or object collection to List Picker without loosing the paging feature

#MDK, #SAP MDK ListPicker

bill_froelich
Product and Topic Expert
Product and Topic Expert
0 Kudos
Is the list picker on the main page of the application?
View Entire Topic
learner1
Explorer
0 Kudos

Hi @bill_froelich,

To the first list picker I am setting the list from the Rule, values are defaulting when the Odata initialised successfully.

clientAPI.read("/OrderApp/Services/ORDERSERV.service", 'Orders', [],  '$top=5000').then(function(oData){
        let data = oData._array;
        if(data){
            data = data.map(({Code, Desc}) => ({
                DisplayValue: Code + ': ' + Desc ,ReturnValue: Code
            }));
            //clientAPI.getPageProxy().getControls()[0].getControl("ListPickder1").setPickerItems(data); -- Did this to set the data which is loading in the picker items and working
            //clientAPI.getPageProxy().getControls()[0].getControl("ListPickder1").setValue(["I47","I01"]); --- Tried this to default the values for testing. But the values actually defaulted are the 1st item from the list repeated twice as the two values set here
            // clientAPI.getPageProxy().getControls()[0].getControl("ListPickder1").reset(); -- Tried this to call the rule which will execute the Odata and populate 
        }
    });

 

// Defaulting the listpikcer values here
clientAPI.getPageProxy().getControls()[0].getControl("ListPicker1").setValue(arrayOfValues);