# dataprovider not getting updated

**URL:** <https://forum.servoy.com/t/dataprovider-not-getting-updated/19255>\
**Category:** Classic Servoy\
**Created:** [May 17, 2017, 9:18am UTC](https://forum.servoy.com/t/dataprovider-not-getting-updated/19255 "2017-05-17T09:18:58Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![ashutoslenka426](https://avatars.discourse-cdn.com/v4/letter/a/cc9497/32.png) [@ashutoslenka426](https://forum.servoy.com/u/ashutoslenka426)\
**Post date:** [May 17, 2017, 9:18am UTC](https://forum.servoy.com/t/dataprovider-not-getting-updated/19255/1 "2017-05-17T09:18:58Z")

</div>

Hi All ,

I have created a combobox using Devex . I am not using the default combobox . I have assigned a valuelist to it . I have assigned a dataprovider to it . It is a form variable . When I am changing the combobox , it is not updating the dataprovder . It is not changing the form variable . What I need to do in js to update it ? . Please help me . Please provide some suggestion .

---

<div class="post-metadata">

**Author:** ![Andrei\_Costescu](https://avatars.discourse-cdn.com/v4/letter/a/e36b37/32.png) [@Andrei\_Costescu](https://forum.servoy.com/u/Andrei_Costescu)\
**Post date:** [May 17, 2017, 10:01am UTC](https://forum.servoy.com/t/dataprovider-not-getting-updated/19255/2 "2017-05-17T10:01:56Z")

</div>

See [https://wiki.servoy.com/pages/releasevi … Id=1869552](https://wiki.servoy.com/pages/releaseview.action?pageId=1869552)  
Combo box .spec file must use pushToServer allow or higher to allow dataprovider value to be changed on server. You can find info about that on that wiki page.

Then in order for the client to push changes to server you have to use either “svy-autoapply” directive it that works with your component or otherwise you need to use the “svyServoyapi.apply” call.  
See [https://wiki.servoy.com/pages/releasevi … Id=8061131](https://wiki.servoy.com/pages/releaseview.action?pageId=8061131) for more details about that.

---

<div class="post-metadata">

**Author:** ![ashutoslenka426](https://avatars.discourse-cdn.com/v4/letter/a/cc9497/32.png) [@ashutoslenka426](https://forum.servoy.com/u/ashutoslenka426)\
**Post date:** [May 17, 2017, 10:24am UTC](https://forum.servoy.com/t/dataprovider-not-getting-updated/19255/3 "2017-05-17T10:24:36Z")

</div>

Hi Andrie ,

I have done that already but still not successful

```auto
  return {
      restrict: 'E',
      scope: {
    	  model: '=svyModel',
		  handlers: "=svyHandlers",
		  api: "=svyApi",
		  svyServoyapi: "="	  
      },
      controller: function($scope, $element, $attrs,$window) {
    	  if($scope.model.Valuelist!=undefined&&$scope.model.dataproviderID!=undefined){
    		  $scope.value=$scope.model.Valuelist[$scope.model.dataproviderID].realValue;
    	 }
    
    	  $scope.selectBox = { 
		        dataSourceUsage: {
		            dataSource: new DevExpress.data.ArrayStore({ 
		                data: $scope.model.Valuelist,
		                key: "realValue"
		            }),
		            displayExpr: "displayValue",
		            valueExpr: "realValue",
		            hint:$scope.model.hint,
					value:$scope.value,
					validationMessageMode:"always",
    	            validationError:{type:'required',message:$scope.model.validationMessage},
					onFocusOut:function(event){
						$scope.handlers.onFocusLostMethodID($scope.value || "no value");
					},
					onFocusIn:function(event){
						$scope.handlers.onFocusGainedMethodID($scope.value || "no value")
					},
     	            onValueChanged:function(company_id){
     	            	//if($scope.handlers.onActionMethodID!=undefined){
     	            		 $scope.value = company_id.value;
     	            		 $scope.handlers.onActionMethodID(company_id.value);
     	            		 $scope.svyServoyapi.apply('dataProviderID');
     	            	//}
			        },	
			            bindingOptions: {
				        	disabled: '!model.enabled',
							 isValid: 'model.isValid',
							 rtlEnabled: 'model.rtlEnabled',
				        }
		        }	 	
		};

```

```auto
   "size": { "type" :"dimension", "default" : {"width": 140, "height": 35} },
	      	"dataproviderID" : { "type":"dataprovider", "pushToServer": "allow","tags": { "scope" :"design" }, "ondatachange": { "onchange":"onValueChanged", "callback":"onDataChangeCallback"}},
	      "enabled" : { "type": "enabled", "blockingOn": false, "default": true, "for": ["dataProviderID","onValueChanged","onKeyPressMethodID"] },
	        "styleClass" : { "type" :"styleclass", "tags": { "scope" :"design" }},   		
	        "visible" : "visible",
	     	"Valuelist":{"type":"valuelist", "tags": { "scope" :"design" },"pushToServer":"allow",

```

Please providse your help and suggestion.

---

<div class="post-metadata">

**Author:** ![paronne](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/paronne/32/5096_2.png) [@paronne](https://forum.servoy.com/u/paronne)\
**Post date:** [May 17, 2017, 11:18am UTC](https://forum.servoy.com/t/dataprovider-not-getting-updated/19255/4 "2017-05-17T11:18:03Z")

</div>

Hi, have you tried already to inspect the browser and debug your clientside code (using the browser inspector) ?  
You should make sure that the $scope.svyServoyapi.apply(‘dataProviderID’); is executed in first place.

Anyhow i see a typo in your spec/js file. You apply the change to the model property “dataProviderID” but in your .spec file the property name is “dataproviderID”. This is why the change is not pushed to the server. Note also that you will get an error in browser console if the element doesn’t have an onAction method id.

> onValueChanged:function(company\_id){  
> //if($scope.handlers.onActionMethodID!=undefined){  
> $scope.value = company\_id.value;  
> $scope.handlers.onActionMethodID(company\_id.value);  
> $scope.svyServoyapi.apply(‘dataProviderID’);  
> //}  
> }

This function can be written like this

> onValueChanged:function(company\_id){  
> $scope.value = company\_id.value; //  
> $scope.svyServoyapi.apply(‘dataproviderID’); // i suggest to rename the property in .spec file to ‘dataProviderID’ to keep it consistent with all other components
> 
> // check if there is an handler, if yes execute the handler.  
> if ($scope.handlers.onActionMethodID){  
> $scope.handlers.onActionMethodID(company\_id.value);  
> }  
> }

Regards,  
Paolo

---

<div class="post-metadata">

**Author:** ![ashutoslenka426](https://avatars.discourse-cdn.com/v4/letter/a/cc9497/32.png) [@ashutoslenka426](https://forum.servoy.com/u/ashutoslenka426)\
**Post date:** [May 17, 2017, 11:26am UTC](https://forum.servoy.com/t/dataprovider-not-getting-updated/19255/5 "2017-05-17T11:26:39Z")

</div>

Thanks Paolo it’s working now.

---

<div class="post-metadata">

**Author:** ![ashutoslenka426](https://avatars.discourse-cdn.com/v4/letter/a/cc9497/32.png) [@ashutoslenka426](https://forum.servoy.com/u/ashutoslenka426)\
**Post date:** [May 17, 2017, 12:06pm UTC](https://forum.servoy.com/t/dataprovider-not-getting-updated/19255/6 "2017-05-17T12:06:59Z")

</div>

Hi ,

That issue is fixed . But I am getting another console exception when trying to add the valuelist to the combobox . Although the functioanlityis working fine .

```auto
Valuelist: article_XXXX used with different types
The valuelist was already created for type: INTEGER
 for the dataproviders: Milan
So it can't be used also for type: TEXT for the dataprovider: null
Please edit these dataprovider(s) (using table editor for database column or Edit variable context menu action for variables) of this valuelist: article_XXXX so that they have the same type.

```

---

<div class="post-metadata">

**Author:** ![Andrei\_Costescu](https://avatars.discourse-cdn.com/v4/letter/a/e36b37/32.png) [@Andrei\_Costescu](https://forum.servoy.com/u/Andrei_Costescu)\
**Post date:** [May 17, 2017, 12:55pm UTC](https://forum.servoy.com/t/dataprovider-not-getting-updated/19255/7 "2017-05-17T12:55:28Z")

</div>

How do you add the valeuelist? From properties view?

article\_XXXX is probably a custom valuelist that was used in one place for a dataprovider of type INTEGER.  
Then you add it to your component where the valuelist doesn’t know know it’s for a dataprovider → and tries to default to type TEXT. This is why the error message appears.  
Try “Valuelist”:{“type”:“valuelist”, “tags”: { “scope” :“design” }, “for”: “dataproviderID”(…)

And then if your dataproviderID is INTEGER as well you shouldn’t get that message.  
Btw you don’t have to name it “dataproviderID”, you can choose anything (that is like that due to legacy constraints for default components).

---

<div class="post-metadata">

**Author:** ![ashutoslenka426](https://avatars.discourse-cdn.com/v4/letter/a/cc9497/32.png) [@ashutoslenka426](https://forum.servoy.com/u/ashutoslenka426)\
**Post date:** [May 17, 2017, 1:25pm UTC](https://forum.servoy.com/t/dataprovider-not-getting-updated/19255/8 "2017-05-17T13:25:36Z")

</div>

Hi ,  
My code is already fine I think .

```auto
	"size": { "type" :"dimension", "default" : {"width": 140, "height": 35} },
	      	"dataproviderID" : { "type":"dataprovider", "pushToServer": "allow","tags": { "scope" :"design" }, "ondatachange": { "onchange":"onValueChanged", "callback":"onDataChangeCallback"}},
	      	"enabled" : { "type": "enabled", "blockingOn": false, "default": true, "for": ["dataProviderID","onValueChanged","onKeyPressMethodID"] },
	        "styleClass" : { "type" :"styleclass", "tags": { "scope" :"design" }},   		
	        "visible" : "visible",
	     	"Valuelist":{"type":"valuelist", "tags": { "scope" :"design" },"pushToServer":"allow","dynamicDataproviders":true,"provideColumnFormats":true, "for": ["dataproviderID","onActionMethodID","onDataChangeMethodID"]},

```

Please provide your suggestion.

---

<div class="post-metadata">

**Author:** ![Andrei\_Costescu](https://avatars.discourse-cdn.com/v4/letter/a/e36b37/32.png) [@Andrei\_Costescu](https://forum.servoy.com/u/Andrei_Costescu)\
**Post date:** [May 17, 2017, 1:36pm UTC](https://forum.servoy.com/t/dataprovider-not-getting-updated/19255/9 "2017-05-17T13:36:44Z")

</div>

When does it happen?  
What type is the dataprovider you set on it?

---

<div class="post-metadata">

**Author:** ![ashutoslenka426](https://avatars.discourse-cdn.com/v4/letter/a/cc9497/32.png) [@ashutoslenka426](https://forum.servoy.com/u/ashutoslenka426)\
**Post date:** [May 17, 2017, 1:38pm UTC](https://forum.servoy.com/t/dataprovider-not-getting-updated/19255/10 "2017-05-17T13:38:43Z")

</div>

Thanks for your reply .

This happens when I try to assign the valuelist to the combobox.

I have set it to Integer type of data.

Please provide your suggestion.

---

<div class="post-metadata">

**Author:** ![Andrei\_Costescu](https://avatars.discourse-cdn.com/v4/letter/a/e36b37/32.png) [@Andrei\_Costescu](https://forum.servoy.com/u/Andrei_Costescu)\
**Post date:** [May 17, 2017, 2:03pm UTC](https://forum.servoy.com/t/dataprovider-not-getting-updated/19255/11 "2017-05-17T14:03:21Z")

</div>

> ashutoslenka426:  
> This happens when I try to assign the valuelist to the combobox.

How exactly do you try to assign? From the properties view? From javascript (at runtime)?

---

<div class="post-metadata">

**Author:** ![ashutoslenka426](https://avatars.discourse-cdn.com/v4/letter/a/cc9497/32.png) [@ashutoslenka426](https://forum.servoy.com/u/ashutoslenka426)\
**Post date:** [May 17, 2017, 2:06pm UTC](https://forum.servoy.com/t/dataprovider-not-getting-updated/19255/12 "2017-05-17T14:06:11Z")

</div>

From the properties view.

---

<div class="post-metadata">

**Author:** ![Andrei\_Costescu](https://avatars.discourse-cdn.com/v4/letter/a/e36b37/32.png) [@Andrei\_Costescu](https://forum.servoy.com/u/Andrei_Costescu)\
**Post date:** [May 17, 2017, 2:50pm UTC](https://forum.servoy.com/t/dataprovider-not-getting-updated/19255/13 "2017-05-17T14:50:08Z")

</div>

It says “So it can’t be used also for type: TEXT for the dataprovider: null”  
So it doesn’t find the dataprovider value set in dataproviderID.

You set lots of things in the spec that are not supported on the valuelist type.  
Try with just “Valuelist”:{“type”:“valuelist”, “tags”: { “scope” :“design” },“for”: “dataproviderID” }.

dynamicDataproviders and provideColumnFormats are only meant for foundset property types, “for” in valuelist properties types should point directly to a dataprovider typed property, so not an array that also contains handler names.

---

<div class="post-metadata">

**Author:** ![ashutoslenka426](https://avatars.discourse-cdn.com/v4/letter/a/cc9497/32.png) [@ashutoslenka426](https://forum.servoy.com/u/ashutoslenka426)\
**Post date:** [May 18, 2017, 4:03am UTC](https://forum.servoy.com/t/dataprovider-not-getting-updated/19255/14 "2017-05-18T04:03:48Z")

</div>

Thanks for your reply . But still not working.

---

<div class="post-metadata">

**Author:** ![ashutoslenka426](https://avatars.discourse-cdn.com/v4/letter/a/cc9497/32.png) [@ashutoslenka426](https://forum.servoy.com/u/ashutoslenka426)\
**Post date:** [May 18, 2017, 6:04am UTC](https://forum.servoy.com/t/dataprovider-not-getting-updated/19255/15 "2017-05-18T06:04:30Z")

</div>

I would like to explain the exact scenario . I have developed the dropdown web component for devex . when I am placing only the dropdown web component , it is not showing any exception .

When I am placing both the dropdown component as well as the default servoy dropdown , it is throwing the exception .

[http://forum.servoy.com/viewtopic.php?f=22&t=21016](http://forum.servoy.com/viewtopic.php?f=22&t=21016) . Please refer this

Please provide some suggestion.

---

<div class="post-metadata">

**Author:** ![Andrei\_Costescu](https://avatars.discourse-cdn.com/v4/letter/a/e36b37/32.png) [@Andrei\_Costescu](https://forum.servoy.com/u/Andrei_Costescu)\
**Post date:** [May 22, 2017, 11:02am UTC](https://forum.servoy.com/t/dataprovider-not-getting-updated/19255/16 "2017-05-22T11:02:26Z")

</div>

The only thing that I can say is to make sure the dataproviders of both your dropdown component as well as the default servoy dropdown that uses the same valuelist should be exactly the same type.  
So not one DP is text and the other one integer.

If you already made sure that is the case, then it needs further investigation. You should [create a case](https://support.servoy.com) with a sample solution showing this problem then.
