Current filter:
                                You should refresh the page.
                                  • Hello,

                                    We are trying to bind the Select box using API ( JSON format) but are  not able to get the data in select box.

                                    When we are hard coding the data, we are getting data in  select box.

                                    Can you please help us to get through this.

                                    Also sharing the project link ::

                                    https://drive.google.com/open?id=1LAVU2PjZ71iQu5lNMz3xlR4EKf9KVEWN

                                • Maxim (DevExpress Support) 08.09.2019

                                  Hi Sandip,
                                  I have tried your sample, but was not able to run it because some images are missing.
                                   
                                  img.png
                                   
                                  Would you please clarify the particular view where you have issues with SelectBox? I hope to hear from you soon.

                                • Sandip Jadhav 08.11.2019

                                  Hi Maxim,

                                  I have resolved the above error.
                                  Please provide the solution ASAP it will be appreciated. .

                                  Sharing the project link.

                                  https://drive.google.com/open?id=1GBb73D6e_kH4MytxrDZsJJz-PyBABAm7

                                  Thanks & Regards

                                • Maxim (DevExpress Support) 08.13.2019

                                  I have reviewed your sample, the Department.dxview view where I've found dxSelectBox, and was I bit confused:
                                   

                                  [HTML]
                                  <div data-bind="dxSelectBox: Customer"></div>

                                  So, SelectBox's options are stored in the Customer field. Here is your model:
                                   

                                  [JavaScript]
                                  var viewModel = { Customer: { value: ko.observable(true) }, //... Customer: { searchEnabled: true, hint: 'Select Customer', dataSource: new DevExpress.data.ArrayStore({ data: d1, key: "CustID" }), displayExpr:"CustName", valueExpr: "CustID", // value: myObjStr[0].CustID, ///////////////// when we use this getting error ////////////////////// } }

                                  And I see that the Customer field is defined here several times, which is incorrect. Would you please clarify why you define the field several times in detail?
                                   
                                  If you wish to load JSON formated data to a data source you can specify a url directly to a field. See the Ajax Request demo. You can do the same with the SelectBox as well.

                                • Sandip Jadhav 08.14.2019

                                  Hi Maxim,
                                  Thanks for your reply.
                                  As we are using Knockout JS , to make the filed observable we have defined twice.
                                  We can also write in the below format:

                                  [JavaScript]
                                  var viewModel = {     viewShown: function () {         debugger;         var ReqUrl = _globalapi + "Customers/GetCustomersData";        // var dataSource = new DevExpress.data.DataSource(ReqUrl);         $.getJSON(ReqUrl, function (data1) {             debugger;             myObjStr = JSON.stringify(data1.ReturnValue);             d1 = JSON.parse(myObjStr);         });     },     Customer: {         searchEnabled: true, hint: 'Select Customer',         value:ko.observable(true),         dataSource: new DevExpress.data.ArrayStore({             data: d1,             key: "CustID"         }),         displayExpr:"CustName",         valueExpr: "CustID",        // value: myObjStr[0].CustID,         /////////////////  when we use this getting error    //////////////////////     } }; return viewModel;

                                  The data we are using is in JSON format through API not in json file.

                                1 Solution

                                Creation Date Importance Sort by

                                This question is not directly related to the DevExpress library. The cause of this issue is that you did not update the Knockout model, but simply modified a variable. I've created a small test sample without the DevExtreme library to illustrate the same issue.
                                 
                                While we are always happy to help you with our products, we recommend that you ask general programming questions on public Q&A forums like https://stackoverflow.com/ or directly in the knockout repository of the "issues" section: https://github.com/knockout/knockout.
                                 If you have any questions about our API, feel free to contact us at any time.

                                Show all comments
                                • Sandip Jadhav 08.16.2019

                                  Hello Maxim,
                                  We appreciate for your all help.  Is it possible for you to rectify our code? We are literally stuck here.

                                  Can you please provide combo Box population using WebApi which is connected to SQL.

                                  On all sample projects Json data is hardcoded which is not helping us at all.

                                  Thanks much
                                  Sandip

                                • Maxim (DevExpress Support) 08.16.2019

                                  Sandip,
                                  I recommend that you review the Knockout - Web API Service demo. The DataGrid is bound to the web api service there, but the approach for the select box is the same. You need to properly specify a URL to your server for the loadUrl field and pass it to the DevExpress.data.AspNet.createStore method.
                                  Check out the Web API Service help topic for more info. I hope you will find it useful.

                                • Sandip Jadhav 08.17.2019

                                  Hi Maxim,
                                  We appreciate your help.
                                  We are not able to bind the select box (knockout JS) from the above reference.

                                  Reference you have given is for dataGrid and we won't able to get same property for SelectBox.  We need help on this to resolve issue which is pending from so many days.

                                  Can you please show the sample implementation for the same.
                                  Thanks 

                                • Maxim (DevExpress Support) 08.19.2019

                                  I have attached a small test sample to illustrate how to bind SelectBox to a remote Web API service using the createStore method from the DevExtreme.AspNet.Data library. I hope you will find it useful.

                                • Sandip Jadhav 08.30.2019

                                  Can you please guide us to add the  "" /node_modules/devextreme-aspnet-data/js/dx.aspnet.data.js""   file in our project for select box.

                                  We have tried with npm but getting an error:
                                   "The term 'npm' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that
                                  the path is correct and try again."

                                  How can we solve this problem.

                                • Maxim (DevExpress Support) 08.30.2019

                                  The basic guide like for installing the dx.aspnet.data library is described in the Client Side with jQuery - Installing help topic. You can also use the CDN to load the library:
                                  https://unpkg.com/devextreme-aspnet-data@2.4.2/js/dx.aspnet.data.js

                                • Sandip Jadhav 09.02.2019

                                  Hi Maxim,
                                  As per the demo project, We have added the CDN  as well as "dx.aspnet.data.js"  in to the project but I won't be able to populate the SelectBox Value.

                                  Demo Page : - home.

                                  Please find the project in attachment .

                                • Maxim (DevExpress Support) 09.03.2019

                                  I have reviewed your sample and see that the cause of the issue lies in the script order on the main page. The dx.aspnet.data library is integrated with the main DevExtreme library so it should be defined after it.
                                   

                                  [HTML]
                                  <script type="text/javascript" src="js/dx.all.js"></script> <script src="node_modules/devextreme-aspnet-data/js/dx.aspnet.data.js"></script>

                                   
                                  I've tested your sample, and the dx.aspnet.data library is properly integrated after this change, and the app makes a request to load data. Meanwhile, I cannot load data because the "http://localhost:2383/api/CountryStateCity/GetCountry" URL is not available on my side, but I expect that it should work properly in your environment.