That's the only way I could get it work, both for NavGrid or filterToolbar.
Reloading has no effect from server side , even if I'm sure that the resulting json data is correct.
Am I wrong ?
If you have implemented searching on the server side you don't need to use loadonce: true. Die implementation of Advanced Searching for example consist from analyzing of filters parameter which can be send to the server as the part of request to fill the grid. The format of filters parameter is described here. If you would use stringResult: true parameter of filterToolbar then you will have the same format of input data in both Advanced Searching and Toolbar filtering.
Related
I'm trying to upgrade from jqGrid v4.7 to the latest jqGrid 4.12.1 - free jqGrid fork.
The problem I face is that, using server side searching, filter parameters donĀ“t get built using the former
{"groupOp":"AND","rules":[{"field":"Name","op":"cn","data":"bob"}]}
style, I just get an additional Name parameter with bob value (_search is true).
What am I missing here?
Thanks in advance
I suppose that you use filterToolbar without stringResult: true parameter and the problem have no relation with the upgrade of jqGrid 4.7 to free jqGrid 4.12.1. See the first part of the documentation of filterToolbar which describes:
When the search is activated, an array of type name:value is posted
to the server. Note that this array is added to the postData
parameter. We post only fields that have an entered value. When we
clear the the search form, the values are deleted from the postData
array. When posting to the server, we try to pass, not the name, but
the index set in colModel. When the index is not found we use
the name. Additionally, we add a _search=true to the posted data.
When the stringResult option is set to true the data posted to the
server is a string and the structure of the posted data is the same as
in Advanced Search.
I'm trying to fix XSS vulnerabilities across my web application and I'm stuck with jqGrid.
I activated 'autoencode' for all my grids and the documentation says : "When set to true encodes (html encode) the incoming (from server) and posted data (from editing modules).".
My problem is that I don't understand why posted data are encoded. This way I'm getting html escaped text in my database. So this database is no more readable by an other application (or it has to decode all texts), and in addition database search doesn't work any more.
So, is it possible to only encode data retrieved from database and post data as it ?
Currently, I disabled autoencode and added formatter on all my columns to escape all text. Is it the only way ?
You can use serializeEditData (in case of usage form editing), serializeRowData (in case of usage inline editing) or serializeCellData (in case of usage cell editing) to change the data which will be send to the server during editing. To decode the data you can use for example $.jgrid.htmlDecode. You can enumerate all properties of posted data and decode the value of the corresponding property. Alternatively you can use decoding of posted data on the server side. Any technology which you use on the server provide simple method which can be used for decoding. For example in ASP.NET one can use HtmlDecode/HtmlEncode methods of HttpServerUtility.
Using a Grid component, we wish to sort and filter rows using hidden values.
Sort and filters are working fine with visible values,
but we have now changed the format used for display,
and we wish to use previous values for sort and filtering.
We are using the ArrayStore, without any proxy.
We are looking for a solution on the client side, in JavaScript only
(no round trip to the server).
http://dev.sencha.com/deploy/dev/docs/?class=Ext.data.ArrayStore
suggest look at methods sort() and filter(), others also can be usefull
I want to implement DHTML grid . Which required server side sorting and pegging with ajax support.
Dose any one having any idea about how to implement this.
If you want to implement server side sorting then it does not matter what technology you are using in the front end.
On a conceptual level you can do the following things:
Write a SortingServlet which takes your grid and sorts it according to the request parameters passed to it and renders the output in the form of json(not strictly required but good to have)
Use jQuery to make a Ajax call to this servlet and then format the response when you get it back.
I have a textbox with remote datasource for autocomplete(jquery) [not the plugin, the original one shown in jquery ui demos ]
How do I make sure user typed only what was in one of autocomplete suggestions and nothing of his own ?
The question is lacking specifics, but I will assume you mean validate on the client side since you referred explicitly to the auto complete plugin. This answer will have two parts. The first is the original answer, assuming one autocomplete plugin. The second is revised based on updates to the question.
1) Using http://docs.jquery.com/Plugins/Autocomplete
The best solution for this is the "mustMatch" option. Here is the API documentation.
If set to true, the autocompleter will only allow results that are presented by the backend. Note that illegal values result in an empty input box.
You should be able to use it in this way:
$("selector").autocomplete("url", {"mustMatch": true});
You can also validate the user input in some way in the "result" event. Here is a link: http://docs.jquery.com/Plugins/Autocomplete/result .
2) Using http://jqueryui.com/demos/autocomplete
There is no mustMatch option here. You could extend the plugin, or you could add something similar to what I mentioned for the other autocomplete plugin. Use the "change" event.
$( ".selector" ).autocomplete({
change: function(event, ui) { ... }
});
If you were using an array as a datasource, this would be more efficient. Since you are using a remote data source you would need to do another final query using ui.item to validate the user value. You can then allow or deny the default behavior.
In either case, the input should still be validated in some way on the server side. This is out of the scope of jQuery plugins.