jqGrid with my custom search - jqgrid

I every one i need to something like as shown in the attachment
Can any one help me out. I dont want to use tool bar search and default search of jqgrid.
Thanks.

If I understand correct your question you can solve your problem by adding searchoptions to the colModel item which corresponds "Related To" column. The searchoptions should has sopt property with the operations which you need to allow for the column. For example
searchoptions: { sopt: ['eq', 'cn'] }

Related

how to highlight only cell when click on jqgrid grid

I have jqgrid in which cells are created by java as a hyperlink, attached the image for the same.enter image description here
I want to highlight that particulate cell when i click on any count on that jqgrid.
Please refer image for the same.
jqGrid supports cell editing, which can be activated by adding the option cellEdit: true. It's important that it allows to edit content of not every columns, but the columns, which have editable: true property. If the column don't have editable: true property the the cell will be highlighted. Thus if you don'u use currently editing feature in the grid and you don't have editable: true property in any columns of colModel then adding cellEdit: true option of jqGrid should solve your problem.

CheckBox as jqGrid Filter

Is there any chance to use CheckBox as jqGrid Filter?
Assuming, that i have field with values only 0 and 1.
If checkbox will be checked then filtred value will be 1, no filtering.
The reason, why one don't use checkboxes in the filter toolbar, is very simple: one need 3-state checkbox: checked, unchecked and not-defined:
"checked" state means filtering by checked (1 value in your case)
"unchecked" state means filtering by unchecked (0 value in your case)
"not-defined" state means no filtering by the column
Because of that one use mostly the property like
stype: "select", searchoptions: { sopt: ["eq", "ne"], value: ":Any;1:Yes;0:No" }
to have drop-down select element in the filter toolbar. The texts "Any", "Yes" and "No", like the values 1 and 0 can be changed to another values depend on your requirements.
UPDATED: jqGrid allows to to create custom searching interface by usage stype: "custom" and implementing custom_element and custom_value callbacks of of searchoptions See the old answer and the Searching Dialog. I would still don't recommend you to do this, because it makes things more complex without any real benefit for the user. I'm sure that some users will ask you for filtering about non-checked state: the more users the more different opinions. Select is the standard interface which know everybody and everybody understand it's meaning in the same way.
I modified the old demo to the following which demonstrates the possibility of stype: "custom" in the searching toolbar. After the click on the custom control of the filter toolbar one will see the picture like below:
I used in the demo of cause free jqGrid fork of jqGrid - the fork, which I develop staring with the end of 2014.

the selected value was cleared in dropdown after add new criteria in jqgrid advanced searching

In jqgrid advanced searching, the value selected in drop down list was cleared after i add new criteria.
Below detail for your reference.
1) in jqgrid column model
{name:'instrumentType',
index:'instrumentType',
searchoptions:{
dataInit:instrumentTypeDataInit,
sopt: ['eq','ne','nu','nn','in','ni']},
align:"left",
stype:'select'},
2) javascripts function for instrumentTypeDataInit
instrumentTypeDataInit=function(el){
var categoryInstrumentTypeOptions = "${categoryInstrumentTypeOptions}";
$(el).append(categoryInstrumentTypeOptions);
}
3) when add criteria "Instrument Type", and select "OPTION", it goes well.
4) when add another criteria, the value selected is cleared.
Does anyone know why it is? and what's the solution? thanks a lot.
EDIT:
i've used the dataInit function in the wrong way, used searchOptions.value instead, the issue has been resolved, you can refer another post:best way to dynamically populate dropdown options in jqgrid advanced searching
i've used the dataInit function in the wrong way, used searchOptions.value instead, the issue has been resolved, you can refer another post, Oleg has given an answer:

Custom error message in search box jqgrid

I want to display a custom error message if the search field is empty. Please tell me how can I do it.
If I understand you correctly you can use searchrules inside of colModel. For example
searchrules: {required: true}

jqGrid hide a field

I am new to jqGrid, and having trouble with achieving a couple of tasks. Any guidance will be a huge help.
I have a field (CREATE_DATE) whose value needs to be passed in the edit form. To achieve this I have to make it editable, but at the same time I don't want it to display in the edit form. Something similar to this issue (http://stackoverflow.com/questions/2368051/jqgrid-how-to-have-hidden-fields-in-an-edit-form) Something like this is what I want to achieve.
$('#CREATE_DATE_id]').attr('type', 'hidden');
Thanks a lot.
If you have some hidden column in the grid and you want to send the value only during the row editing you should include in the definition of the column the following properties:
editable: true, hidden: true, hidedlg: true, editrules: { edithidden: true }
If you want to display the column in the grid and need to send the data to the server, but you just don't want to display the data in the edit form you can mark the column as editable: true, but hide the field inside of beforeShowForm callback. You can even implement different behavior in Add and in Edit forms. See the answer for more details.

Resources