I have an JSP, servlet application where I am using a java dashboard to display the grid data. For a specific project, I want to use the editable slickgrid. I have successfully integrated the grids to display data. But now, I need to send/post the data back to the servlet for processing. I referred to the question here Saving changes in SlickGrid and tried using the solution. But the script doesn't send any data to the servlet. At the servlet, when I collect the parameters passed and print them, I get:
In Test Data Input event.
1)event : TestDataInput
2)data :
If I modify the script line:
$("input[name='data']").val($.JSON.stringify(grid.getData()));
to
$("input[name='data']").val(grid.getData());
a lot of [object, object] variables are posted and collected in the servlet.
Can you tell me where am I making a mistake?
Thanks all in advance.
Related
I have a web app using Next and another app using Node. I am wanting to pass data from my Node app to my Next one in the form of a JSON object. I can get the data into the Next API by using a POST request and that works, what I want to know is if there is a way to pass the data from the API file into a component?
I have created a site dashboard which has 3 dashlets. The data required by 3 dashlets and displaying in different views.
Currently I am using rest api call using "connector.get" inside webscript1.get.js,webscript2.get.js and webscript3.get.js files. Repeatedly calling in all three dashlets.
My question is, can I call it once and share the object with all three dashlets? I tried doing this with surf root objects, but those objects are immutable. Please can any one help?
In this case what you can do is, save the response of your ajax call in one global javascript variable.When first time you are calling an api, it will call the api and then set the response of it to a global javascript variable.
In other dashlets you can check whether this variable is null or not, If not null you can use the data.
I have used this to chain dynamic data drop downs in an Orbeon application using the following services:
1. /xforms-sandbox/service/zip-states
2. /xforms-sandbox/service/zip-cities?state-abbreviation={../state}
3. /xforms-sandbox/service/zip-zips?state-abbreviation={../state}&city={../city}
I have few questions:
I also want to create the same, so can you please point me the code where this services are present. How I should write the service in this case?
{../state} - How it retrieve the state value when it changed?
What is the use of state-abbreviation?
This specific test service is implemented in XPL and XSL, in zip-states.xpl. But it really just is a service that gets called with an HTTP GET by Orbeon Forms, and returns XML. BTW, you can easily test it from your browser, and it could be implemented with any technology.
Whenever the value of the control named state changes, {../state} will return a different value, so the URL for the service will change, so the Dynamic dropdown will load again that URL to retrieve potentially new data.
In this particular example, we want the "abbreviation" to be stored in the data (e.g. "CA"), and the full name (e.g. "California") to be shown in the UI. Again, in this particular examples, values come from states.xml.
I am trying to generate a report by passing parameters selected using two drop down menus which are in page1.aspx and sending them to page2.aspx which is the page for my report viewer (and the report i want to generate).
I tried to use the response.redirect command and server.transfer command with the help of click_button event from my code behind page for page1.aspx but it didn't work.
Can any body help me how to do this, i am trying to figure this out since a really long time and i am new to ASP.NET, i also tried to google it but couldn't find any information regarding the same. Any help would be really appreciated. Thank you
I repeat the question:
What is the way to transfer parameters from page1.aspx to a report viewer in page2.aspx such that the parameters are selected using two dropdown menus in page1.aspx and are used as a criteria to generate report in page2.aspx?
You could create an object class where you save the state of parameters.
Inside that object you create 2 variables par1 and par2.
In page1.aspx when you define what the parameters are, assuming this is not directly a report parameter, but still has to be passed into a report that you will load, you could create a new instance of the class object, store the variables within, and reference that object in page2.aspx when calling the report url into the reportviewer.
In case you are loading parameters inside the report, i think you need a dataset in report1 that uses a stored procedure that includes saving the parameters in a database table. That way, in your second report you can call for this stored data directly in the database.
Those 2 solutions i think should do. If you need more help let me know.
I need to get some Json to the client side from the server and it's somewhat troublesome as almost all tutorials assume an Ajax call to a separate action to get the Json.
This led me to think that there must be some reason why it is done this way. In Asp.Net MVC we can pass a Model along with the view to get the information but we can't seem to easily pass a Json object. Instead you are supposed to make a separate call to get this information.
What if the Json info is known when the page is generated, why not generate it at the same time?
I'm sorry if I wasn't clear enough. While it's nice to hear of ways to get Json to the client, the question is actually whether there is a specific reason the Ajax call method is much more popular, like security or anything like that.
Can you put something like this into your view? (rough pseudo code, assuming using a Razor view)
< script >
var myJSON = { Field: #model.Field, Field2: #model.Field2 };
< /script >
Because you do not need both at the same time... on the first call will be to get html (the view of the data - represented by a view model), and any ajax calls will be to get the possibly updated data (json serialized view model).
No reason why you can't. You could use the javacript serializer to create a JSON string that drop on the page. You could also create an action that return the json string that you called from a script tag.
What you want if you're using KnockOut, would be the Mapping plugin that turns an ordinary JS object, like that generated above, into an observable ready for KnockOut to use. See here from info. http://knockoutjs.com/documentation/plugins-mapping.html
You can use content-negotiation by setting accept header. This is considered a best practice (and according to some RESTful).
This needs to be supported and implemented at server as well. ASP NET MVC does not make it easy to support content-negotiation and you have to implement it yourself by if-else or using ActionFilter and implementing action selector.