I've created a new method in my class and defined a service interface for it.
It appers in my <service>.json definition.
Now I want to run this operation in my application, but I have no ideia how to do it.
What I would like to do is something like this:
jsdosession = new progress.data.JSDOSession(jsdoSettings);
jsdosession.login();
jsdosession.run(myOperation);
Does someone knows how to to it?
It sounds as if you may need to use the invoke() method of the JSDO object.
I do know that in your example, you would need to call jsdosession.addCatalog() after the login() call, then create a progress.data.JSDO object to call your method. The JSDOSession is only for logging in and getting the catalog, so that you are set up to start using a JSDO to work with your data.
--Wayne
Hello,
After creating the JSDOSession, you would create a JSDO instance for your resource (Business Entity).
Example:
var jsdo = new progress.data.JSDO({name: "Customer"});
Any method that you have exposed as an invoke can then be called using the JSDO.
You can invoke the method by name or using the invoke() method in the JSDO.
For example, if your method is called "CustomRead" you could use either of the following approaches to call it:
jsdo.CustomRead({});
or
jsdo.invoke("CustomRead", {});
The difference is that the invoke() method returns a promise to handle the response of the method. Whereas when calling the method by name returns the an object with the result of the operation.
You can use an AfterInvoke event to handle the response of invoke operations, whether you call them using the name or the invoke() method.
Here is an example passing an input parameter:
jsdo.MonthlySales({piYear: 2014});
Take a look at the following examples that use invoke operations:
oemobiledemo.progress.com/.../example004.html
oemobiledemo.progress.com/.../example015.html
oemobiledemo.progress.com/.../example016.html
Did you create the JSDO using Kendo UI?
If this is the case, then you would need to get the reference to the JSDO from the Kendo UI DataSource using dataSource.transport.jsdo.
Please let me know if you need more information.
is there a front end "index" to these demo pages?
Yes, I'm using Kendo.
I can grab the information you said egarcia, but I can't do anything with it, seens to be a string:
Object {type: "jsdo", transport: Object, table: null, fields: Array[5], pageSize: 9…} data: undefined error: (e) fields: Array[5] pageSize: 9 select: null success: (e) table: null transport: Object jsdo: "admLicenca" __proto__: Object type: "jsdo" __proto__: Object
And when I try to use my method, the following error appers:
Uncaught TypeError: myJSDO.RegenerarGUID is not a function
Hello,
Sorry that an index page for the examples has not been available.
I have added links to the examples from the index page of the site: oemobiledemo.progress.com/
Thank you and regards.
thanks
Hello Matheus,
In your post, It does not seem that "myJSDO" is pointing to the JSDO instance.
The JSDO instance would look like the following in the web inspector:
JSDO {_buffers: Object, _numBuffers: 1, _defaultTableRef: JSTableRef, _async: true, _dataProperty: null…}
Is there a jsdo property under the transport property?
Also, make sure that your invoke method is listed in the JSDO catalog file.
If it is not listed, then the method in the Business Entity needs to have the the appropriate annotation.
I hope this helps.
Edsel
---
P.S.:
Did you create your app using the Telerik Platform Template (as done in the Mobile Workshop) or using the new Views service functionality?
I'm creating my dataSource this way:
var myDataSource = { type: "jsdo", transport: { jsdo: "admLicenca" },
The property that you said before it's pointing to this string "admLicenca", the same way that the demos that you posted did (KendoUIGridCRUD.html):
dataSource: { type: "jsdo", transport: { jsdo: "Customer" }, error: function(e) { } },
The question would be, how can i get the "real" jsdo, for invoking my method?
Edit:
Just to make things more clear:
The progress.data.JSDO seens to be created and handled by KendoUI, how can I acess this information?
When defining the Kendo UI DataSource for the JSDO, the JSDO can be specified in two ways:
- setting transport.jsdo to the name of the resource
- setting transport.jsdo to an existing JSDO instance
when setting transport.jsdo to the name of the resource, the actual JSDO instance is created behinds the scenes.
Afterwards, the transport.jsdo property would point to the JSDO instance.
If you have a reference to a Kendo UI widget, you can use something like the following to get the JSDO instance:
$("#grid").data("kendoGrid").dataSource.transport.jsdo)
Got it, thanks.
I used the code below, inside the columns.command.click property
var promisse = this.dataSource.transport.jsdo.invoke('RegerarGUID', {"pLicencaID":11});
--
Don't know if you can help me with this either, but for "retrieving information / updating interface" from the grid, I should search for an similar method/option of dataSource?
Great. You are welcome.
Yes, ingeneral, you should look at the info for the Grid and the DataSource to see what options and methods are available, but what specific method to use would depend on what you are trying to do.
Could you provide some details on what you are trying to do from the grid?
It's a custom buttom on the grid that updates an field.
Got all working now.
click: function(event){ event.preventDefault(); var tr = $(event.target).closest("tr"); // get the current table row (tr) // get the data bound to the current table row var data = this.dataItem(tr); var promisse; promisse = this.dataSource.transport.jsdo.invoke('RegerarGUID', {"pLicencaID":data.cdnLicenca}); promisse.done(function(session, result, details){ var retorno; retorno = details.xhr.response; retorno = angular.fromJson(retorno); console.log(retorno.response); $scope.errorHome = false; $scope.errorHomeMsg = ''; data.set('codGUID', retorno.response.pGUID); })