jqGrid Json,decompression - jqgrid

Use jqGrid, how to load the local json request directly data without url, consult ace,
JqGrid whether uncompressed version of the source

I am not sure what do you mean under "decompression" or "uncompressed". If you want use not minimized version of jqGrid you should just include another JavaScript files.
If the data are a string in JSON format you should create the grid using the parameter datastr and the datatype:'jsonstring' (see documentation for more information). If the data are not JSON but an object instead you can use data parameter and datatype:'local' or methods like setRowData. Take in the consideration that the usage of localReader can be required (see Array Data in the documentation).

Related

How can I keep tradicional filter format for new free-jqgrid?

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.

Joomla Component override template

I'm writing a Joomla 2.5 or 3.x component
which make data elaboration and returns some data.
I want that work as a service that is invoked and returns data
(eg
I call www.mysite.com?option=com_mycomponent&view=myview
and result for example my json data ..or xml or what i need after my elaboration
)
so i need that my output view is raw.
i need no template and no css or js..
only my result..
but now the results are inserted into the template
Is it possible?...
I tried to create a RAW mode in my template
like Here .
this works but is not what I want
but it is a dirty solution
because it work if the url i have to call is like ...
www.mysite.com~....~&tmpl=raw
I'd like my component can output as raw.
Thanks
Create RAW view views/[myview]/view.raw.php inside your component
In requests require RAW format
index.php?option=com_mycomponent&view=myview&format=raw.
Like in com_banners/views/tracks/view.raw.php.
Sames goes for JSON and XML.
Here's a list of generic document formats: libraries/joomla/document
feed
html
image
json
opensearch
raw
xml
To use JSON format in response, I recommend new JResponseJson class:
// Anything that may be serialized with json_encode or an Exception
$data = array('some' => 'data');
echo new JResponseJson($data);

jqgrid autoencode=true encode postdata

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.

CodeIgniter Pagination & GET

See: http://codeigniter.com/user_guide/libraries/pagination.html
I do not want to use URI segments for my pagination (as I have a lot of possible parameters to pass in unknown order). Currently, I have $config['enable_query_strings'] = FALSE;, and if I set it to TRUE, I get something like this (from CI's example):
http://example.com/index.php?c=test&m=page&per_page=20
Where "c" is the controller, "m" is the method, etc. This is not what I want.
I want something like this:
http://domain.com/?min_amount=100&max_amount=200&color=blue&size=large&limit=20&limit_offset=100
Is there a way to achieve this in CI? If not, is there some library already available that I can use?
In CodeIgniter, there are two configuration options when it comes to query strings.
One option ($config['allow_get_array'], enabled by default) allows you to pass additional queries on to the already segmented URI, which would then be available via the $this->input->get() controller library function. You would set the pagination config using this function, allowing you to separate the route, and the pagination instructions.
The other option ($config['enable_query_strings']) forces you to use the query strings in place of the segmented URIs.

So searching only works with loadonce:true?

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.

Resources