Quantcast
Channel: VMware Communities : Discussion List - vSphere Client SDK
Viewing all articles
Browse latest Browse all 2218

vSphere Web Client HTML: view not updating when calling WEB_PLATFORM.sendModelChangeEvent

$
0
0

Hi,

I have a view in my HTML plugin that shows a list of objects on the LHS and a more detailed list with multiple columns in the center. I have an add button, that opens a dialog which allows the user to enter a "username", "password" (and some other fields). When the user clicks on "submit" a request is made to my service-layer and an object is created in the back-end. Now I want my lists to update accordingly. Here's my problem:

 

At first I used WEB_PLATFORM.callActionsController(url,json) to make the call to the service layer. The two lists are getting updated nicely and everything works fine. However, I can't use WEB_PLATFORM.callActionsController(url,json) because this is sending a password as a URL parameter.

 

Next, I used "$post(url, json, ..." to make the call to the service layer. This way the password is sent in the body of the request which is better. In the response handler, I used "WEB_PLATFORM.sendModelChangeEvent(responseStr["result"],"add");" to update the UI after the request was successful (responseStr["result"] contains the ID of the newly created object). However, this only updates the LHS list and not the list in the center.

 

Note:

The LHS list is added in the plugin.xml as a <templateInstance> with <templateId> "vsphere.core.inventory.objectViewTemplate" and a <namespace> with value "x.y.z" . The list in the center is an extension with <extended point> "x.y.z.list.columns".

 

After a manual refresh of the browser, both lists get updated perfectly.. but of course I would like things to get updated automatically.

 

Another note: The UI I'm working on is basically the same as the sample/chassisA-html example when going to "Global Inventory"->"Chassis A". Referring to the sample, I'm trying to add a chassis with password input, where I don't want the password to be sent as a URL parameter. So another way to reproduce this problem is: In the JavaScript code to add a Chassis (editChassisAction.js), replace "WEB_PLATFORM.callActionsController(url,json)" with $.post(url,json,response_handler) and in the response_handler call "WEB_PLATFORM.sendModelChangeEvent(responseStr["result"],"add");" in order to update the UI. Only the LHS list will get updated but not the one in the center.

 

Thanks for your help!


Viewing all articles
Browse latest Browse all 2218

Trending Articles



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