{"action":"created","issue":{"url":"https://api.github.com/repos/free-jqgrid/jqGrid/issues/13","labels_url":"https://api.github.com/repos/free-jqgrid/jqGrid/issues/13/labels{/name}","comments_url":"https://api.github.com/repos/free-jqgrid/jqGrid/issues/13/comments","events_url":"https://api.github.com/repos/free-jqgrid/jqGrid/issues/13/events","html_url":"https://github.com/free-jqgrid/jqGrid/issues/13","id":58493708,"number":13,"title":"Predefined values in FilterToolbar","user":{"login":"smartcorestudio","id":2891792,"avatar_url":"https://avatars.githubusercontent.com/u/2891792?v=3","gravatar_id":"","url":"https://api.github.com/users/smartcorestudio","html_url":"https://github.com/smartcorestudio","followers_url":"https://api.github.com/users/smartcorestudio/followers","following_url":"https://api.github.com/users/smartcorestudio/following{/other_user}","gists_url":"https://api.github.com/users/smartcorestudio/gists{/gist_id}","starred_url":"https://api.github.com/users/smartcorestudio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smartcorestudio/subscriptions","organizations_url":"https://api.github.com/users/smartcorestudio/orgs","repos_url":"https://api.github.com/users/smartcorestudio/repos","events_url":"https://api.github.com/users/smartcorestudio/events{/privacy}","received_events_url":"https://api.github.com/users/smartcorestudio/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-02-22T07:11:22Z","updated_at":"2015-02-22T15:58:43Z","closed_at":null,"body":"I think that is a very common case, but I didn't find any elegant solution for this. Let's imagine that we have jqQrid with user actions log, for example. By default it has no predefined filters. Also we can have links like \"Show user actions\" on users profile pages, which open logs for this user. So, user will be selected in the FilterToolbar and table will be prefiltered\r\n![2015-02-22 09_54_19- dekonadzor ru](https://cloud.githubusercontent.com/assets/2891792/6317765/0634da3a-ba79-11e4-8fd7-0aefbf58f3ff.png)\r\nI tried to find solutions for this simple use case, but I had no luck. This solution http://stackoverflow.com/questions/2440417/jqgrid-filter-toolbar-initial-default-value/3165512#3165512 looks a bit tricky, don't you think so? Is it possible to have this built-in, without need to prevent initial loading by changing datatype and manual triggering? I.e. we have jqGrid tuned for loading data from server. If we don't have any predefined values in the filter toolbar it just loads all the data, if we have some - grid respects it and loads prefiltered data\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/free-jqgrid/jqGrid/issues/comments/75441920","html_url":"https://github.com/free-jqgrid/jqGrid/issues/13#issuecomment-75441920","issue_url":"https://api.github.com/repos/free-jqgrid/jqGrid/issues/13","id":75441920,"user":{"login":"OlegKi","id":249117,"avatar_url":"https://avatars.githubusercontent.com/u/249117?v=3","gravatar_id":"","url":"https://api.github.com/users/OlegKi","html_url":"https://github.com/OlegKi","followers_url":"https://api.github.com/users/OlegKi/followers","following_url":"https://api.github.com/users/OlegKi/following{/other_user}","gists_url":"https://api.github.com/users/OlegKi/gists{/gist_id}","starred_url":"https://api.github.com/users/OlegKi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OlegKi/subscriptions","organizations_url":"https://api.github.com/users/OlegKi/orgs","repos_url":"https://api.github.com/users/OlegKi/repos","events_url":"https://api.github.com/users/OlegKi/events{/privacy}","received_events_url":"https://api.github.com/users/OlegKi/received_events","type":"User","site_admin":false},"created_at":"2015-02-22T15:58:43Z","updated_at":"2015-02-22T15:58:43Z","body":"Sorry, but I still don't understand the problem. I don't see any problem to implement all what you need in the existing (or old) jqGrid. I don't understand why you just not describe the problem **exactly**? You posted some part of the code. You use `datatype: \"json\"` **without** `loadonce:true` in the example. So you implemented probably filtering of data **on the server side**, but you don't describe which one. I always use `stringResult: true` to have one common searching/filtering implementation for all cases, but your code don't. It's not really a problem, but the implementation can depend from the choice. I asked you the question about it, but you don't answer. The problem is the following: if I understand your problem correctly than I see *multiple alternative solution* of the problem, but the implementation depend from the format of filtering which you use (`stringResult: true` or not). Some solution are very simple, but not so common.\r\n\r\nYou posted the code, but you don't defined any filter (at least an exact example of the filter). The first post looks more like you need to set filter on `who` column, but I don't see any `searchoptions` options in the column and no `searchoptions.value`. You specified just `editoptions.value`. The format of `value` is also not clear. Do you use string format or object format? \r\n\r\nLoading of *filtered data* with *predefined* filter is very easy. If you implemented some kind of filtering (with or without `stringResult: true`) then the server ('z-logs.php') expect additional parameter added to URL which specify the filter. It's `filters` option in case of usage `stringResult: true` and the name of the column if you use legacy filtering. In any way you can just add `search: true` option to the grid and add the required filter inside of `postData`. In the case the server will get the same request like during filtering and the server will returns the filtered data.\r\n\r\nThe only small problem will be to display the filter, which you used for loading the data, in the filter toolbar. In case of simple example, which you posted initially, it's just one line of code where you use `jQuery.val` on the corresponding `<select>` of the filter toolbar. In case of usage more common filter you can use the code, which I posted in [the old answer](http://stackoverflow.com/a/6884755/315935) many years ago. The only problem could exist if one don't use `value` in `searchoptions` because the select could be filled *after* you try to use `jQuery.val`. One can use the problem too in different ways, but you wrote that you don't use `dataUrl` currently.\r\n\r\nThere are some other absolute alternative solution of the same problem. One can for example set `datatype: \"local\"` in the grid to prevent loading unfiltered data from the server during creating the grid. Then one can use `jQuery.val` to choose the user in select of `who` filter. After that one can set `datatype: \"json\"` and trigger `.change` event on the `who` filter. The filtered data will be immediately loaded from the server.\r\n\r\nIf I misunderstood your requirements, please send **more detailed description of your problem**, so that I don't guess. If you speak about some predefined filter - you should include an example of someone and to include some example of `value` instead of `value:\"<LIST OF VALUES HERE>\"`. We can solve the problem *exactly* on some example and you can use the solution in more common case."}}