This is my sample application layout
What i am trying to achieve is plot the real time values graph in the embedded browser.In the net i got a candlestick graph using d3js which suits my purpose.It call a javascript function taking json object as argument.(This json construction i will create in my application using json c++ library based on the DB data)
Backgound:
Realtime values is published to DB by an external application.When the user select the "Source" from the combo box.and click on Draw button real time garph is ploted.
Workflow:
When the user clicks the "Draw" button ,my application queries the DB and created a json object.Till here i am able to do.Now i need to call the javascript function to display the graph in the embedded browser.This part am not getting how to achieve.I checked another cef example where there is a button in the webpage.When user clicke that button cef call the V8 execute function and displays the text in the browser.But here i dont have any such button or events happening from the browser.I really need to develop this functionality.Can some please guide me through this..If my requirement is not clear please let me il explain again
Note: am using VS2010 on windows 8
An easy way to do this would be to generate the html (probably including some JavaScript and the Json data) in your Draw-button handler, and then load that html in the embedded browser (no need to create a file each time, just load the html data contained in a string).
I'm not familiar with CEF so I can't give an exact example, but I've been doing something similar with the IE embedded browser in the past.
CefSharp seems to have a function LoadHtml() for that - not sure what function to call from C++.
There should also be a way to call that JavaScript function from within your handler, but then, where/how should it get the Json data?
On the other hand, if the chart isn't too complex, you could as well draw it yourself and avoid an integrated browser altogether.
Related
I am currently automating a PDF form creation workflow filling fields and comboboxes using a combination of Python (PyPDF2) and Javascript. I am actually using Python to inserting JS code at the document level for creating comboboxes in forms automatically populated with fresh database data.
The problem I found is, when an user opens the PDF, fills the form then save its combobox choices everything seems ok, but when they reopen the same PDF, those choices are gone because the document scripts reset the comboboxes again because the code run by itself every time it opens.
I am wondering if deleting those document scripts by setting a document action when the document is saved would solve the problem but I couldn't find any Javascript function for this.
If using only Javascript is impossible, can be done using Python? I couldn't find anything as well.
I would consider PDF API method :
this.removeScript("myScript");
But the problem is PyPDF2 generate JS function random names like this:
PS: This solution (partial solution) cannot be applied because my JS code length change constantly (dynamic)
I have a requirement wherein we have to display a chart and few parameters (date, name etc) inside a pdf file.
The user should be able to modify the chart depending upon the data selected by the user.
I have seen some examples https://www.youtube.com/watch?v=Z5bdBeFwNCU but not sure how these are getting generated.
Any pointer is highly appreciated.
Also I am a java script developer so if there is any solution in JS It would be easier for me to follow
You can look into the docmentation of the creators (Adobe):
Using JavaScript with PDF files - Tutorials about process.
Javascript API reference for PDF format - a PDF document listing all commands.
I did a few projects where charts/diagrams are created on the fly, based on user entries. For that, I used a combination of form fields and annotations, whose parameters are calculated using Acrobat JavaScript.
There is also an undocumented function in Acrobat JavaScript which allows to create the icon for button form fields.
As the actual approach depends a lot on the kind of information and graphs, one would have to look at what has to be accomplished. Feel free to contact me in private, if there is some interest. It might be worthwhile to look at "make or buy"…
I am developing a .Net Core application using MVC in Visual Studio 2017.
I have been developing on it for some time, and 7 months ago I took a break. Now I have returned to develop further on it. Back then I "learned" that the way to render a view within a view was to create a partialView and render that using javascript/jQuery as follows:
$("#div_name").load(<some-url>, { id: <some-id> }, function() {
console.log("loaded successfully");
)};
I assume there are different "integrated" methods for doing this? I find it hard to believe that the only way to load a view within a view is by using javascript/jQuery. Does anyone have some knowledge to share? I can't seem to find anything on Google (but that might just be because I don't know what to search for).
I have been reading up on partialViews and have found that these "can" be loaded from Razor, but if I want to get data from my database context I am unsure of how this would go about. Furthermore found something called components which I will take a look into myself.
However my current problem is that I have a table in my view:
I want it to be that whenever I click a row inside that table I download some data from my DbContext (using my controller) and that data should be put inside a new view that is loaded within the first view so it would be like follows:
Right now it works when I use static "test" data that I generate myself, inside my controller, but not when I try to connect to my DbContext in my controller, even though I am using async calls, I get no data passed through the view.
I would think that .Net Core might have some other way to do this, as I think it is quite tedious to use javascript/jQuery to do this. Am I completely wrong?
EDIT:
After I did some error checking in my code I managed to get it to work (I had my input value to my Controller method receive an int when in fact the value passed was 15 characters long and started with a 3 (larger than the largest value allowed for an int). As soon as I changed the input to the method to a long it worked and I got my desired output. However I would still like to know if there's a different way to do this in .Net Core MVC.
I'm using AngularJS (mainly the client side) and web2py (mainly the server side)together in an app.
I have an issue now.
At a point of the program, I use AngularJS to get some data from the client and these data are store in an AngularJS variable. I planed to use $http.post to submit these data to database directly, but it didn't work due to cross-orign problem.
Right now I'm trying to pass these data(they are in JSON format) back to web2py and let web2py insert these data to database.(similar to submitting a SQLFORM).
Is there anyway I could pass these data as an argument to an web2py function and invoke that function within javascript code?
Possible approach in my mind:
1) Since I could write python in html using {{}}, and I could write html in javascript, could I write python code within javascript using something like: document.write({{python code}}) ?
I tried this but whatever html I write it goes to a brand new html page. I also tried document.getElementById('testDiv').write("<p></p>"); But it doesn't work.
2)use ajax, I'm not familiar with ajax, any example will be really appreciated!
Any thoughts?
Thank you all!
ok so you got me lost for a second there, lets see if i got it right
1- angular as your frontend
2- python as your backend
3- you are rendering an html document in python and delivering it to the browser
4- since python template language uses {{}} as delimiter am assuming you changed the angulars delimiters too
either using ajax or reload you'll need to provide a python post handler script. that takes your data and makes the DB update. if this is going to be a pattern and you are going to be making AJAX CRUD operations, you should use angular resources ngResource if not a simple
$http.post(url,data).success(function(response){})
https://docs.angularjs.org/api/ng/service/$http#post
where url would be your form submission handler url.
if you where to use a form you'll need to set the target to an iframe hidden in your page and the response should a script tag that gets the scope pertinent to your controller and let him know the result of the operation. this is an old approach, but handy when it comes to send information to sites that don't allow CORS which by the way might be the solution to your problem, when storing data directly to your db, you might just need to enable CORS headers in your storage engine API and that should allow you to submit information even when coming from a different domain
After hours of struggles and countless google, here's my workaround solution:
Main problem: the data are stored in AngularJS but AngulatJS could not submit data to database through API due to cross-orign issue. But Web2py could submit data to database using sqlform.
My approach:
1.)When the user click the submit button, invoke 'ng-click="submitBtn()"'.
submitBtn() is a function of the ng-controller, which has access to the data.
2.)In submitBtn(), the function first write data into web2py's sqlform through
document.getElementById('inputId').value=$scope.data;
then the function click the sqlform submit button through
document.getElementById('submitBtn').click();
It took me a lot time to figure out those element ids of fields in web2py's auto-generated sqlform. The way to find them is using developers' inspect element tool in a browser and see the source code directly.
Hope this will help someone will face the same issue!
This is another of my general questionand I am stuck at this point. I have made a W3DS GetScene query in the server and I have got the 3D scene as an output in the viewer. Now I want to trigger the onclick function on the displayed object so that when I click on the object, I can get its id as well as positional co-ordinates in terms of X,Y and Z and use it to trigger GetFeatureInfo request in the background to get the attribute table related to the clicked object. The part I am stuck is about how to trigger the onclick event or lets say how can I make the server understand that the object has been clicked. Is it necessary for the server to have the functionality predefined or is there any other way to instigate the function from the client side with appropriate coding. I have read in some papers that the X3D player BsContact which I am using for viewing the returned 3D scene its own proprietary interface to modify the scene using JavaScript but I am not being able to find a way how?Thanking you in advance.
This is quite not about X3DOM, but about X3D and the way you can route events in an X3D scene.
You will have to define a TouchSensor node inside as a sibling of your shape or transform node: <TouchSensor DEF="TCH"/>
Then you will have to add a Script node, set its child Field nodes and provide a JS file or JS content as CDATA to describe these fields'handling, as described in the instantreality well written documentation
The interaction between JS in the BS player and JS in the webpage is somehow not well documented. However BitManagement have SDK and support. As far as I know, being able to have both sides communicating with each other is the only way to send a request to you server on click since you succeed in listening to it BS Contact side.
Some years ago, I succeeded in creating such a communication with the Octaga Player:
a bidirectionnal communication between, JS Octaga side, JS web page side, and a java applet built with Lejos, receiving and sending orders to an NXT robot.
However: you may now consider X3DOM as the way to display X3D contents on the Web, and so directly avoid any issue on JS(X3D player) to JS(web page) communication.
And then, for implementing event handlers, I let you read this other post on stackoverflow about handling click on an X3DOM shape