Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't get the dynamics value of widgets #806

Closed
RedRaccoon opened this issue Jan 29, 2016 · 2 comments
Closed

Can't get the dynamics value of widgets #806

RedRaccoon opened this issue Jan 29, 2016 · 2 comments

Comments

@RedRaccoon
Copy link

I have a webscript wich get all the workflow I wan't to show, I want to add args depending on checkbox

var list = {
           name: "alfresco/lists/AlfList",        
           config: {
              loadDataPublishTopic: "GET_DATA_WF",
              loadDataPublishPayload: {
                 filtre: checkbox.config.value
              },
              itemsProperty: "data"
           }
        };
var checkbox = {
          id: "ID_CHECK",
          name: "alfresco/forms/controls/DojoCheckBox",
          config: {
            fieldId: "idCheckboxGroup",
            name: "groupFilter",
            label: "Groupe",
            //description: "",
            value: "{value}",
           // onChange:     
          }
        };

In my widget (I know this code is wrong but It's for be more clear of what I would like to do)
I'm able to get the valu of the config (like name or even value) but If I change by checking or un-checking my checkbox, value won't change in my logs

  onGetData: function wfTab_wfTabFilter__onGetData(payload) {

          var url = AlfConstants.PROXY_URI+"wfTab/filter";

         var test = lang.getObject("filtre", false, payload);

      //   var checkboxValue = payload.getValue();


          this.alfLog("warn", "value of the checkbox" +checkboxValue);
@RedRaccoon RedRaccoon changed the title Can't get the value of widgets Can't get the dynamics value of widgets Jan 29, 2016
@draperd
Copy link

draperd commented Jan 29, 2016

Your model is being defined in a WebScript that is running on the server. The value of checkbox.config.value will be whatever it is defined in that WebScript. When the page loads that will be translated into JavaScript running on the client ... the "filtre" attribute will be fixed to whatever it was set to in the WebScript - you cannot reference a JavaScript variable defined and executed on the server from within the browser.

If you want to have list data reloaded based on a changing form control then you should look at the "alfresco/lists/AlfFilteredList" (see http://dev.alfresco.com/resource/docs/aikau-jsdoc/AlfFilteredList.html). We have examples in the unit test application that you can experiment with. See (https://github.com/Alfresco/Aikau/blob/74d632daf1ebb496e7e1240e563a654566853e43/aikau/src/test/resources/testApp/WEB-INF/classes/alfresco/site-webscripts/alfresco/lists/FilteredList.get.js)

The unit test pages for filtered list can be found at this URL (http://localhost:8089/aikau/page/tp/ws/FilteredList) once you've built and started the test application.

@draperd draperd closed this as completed Jan 29, 2016
@RedRaccoon
Copy link
Author

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants