jqGrid hide a field - jqgrid

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.

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.

JQGrid-Trirand. How to Edit Fields?

I have one page where i have bind data by using JqGrid, but My requirement is In editing one row of a grid, the editable fields must NOT BE builtin fields( builtin textboxs) i want to bind that to other textboxes, check boxes which are outside grid. The data which i want to edit must be supplied to other input controls other than jqgrid builtin input controls, Finally IS THIS POSSIBLE???
Hope iam clear with my question.
Please do help me in reply saying either YES or NO or How, and why.
edited
I am not sure that I understand correctly what you mean, but it seems that you should just use form editing mode. To activate it on the client side you should just add editable: true property to all columns which are editable or use the option cmTemplate: {editable: true} which makes default value of editable for all columns as true. After it you can for example use navGrid to add Add, Edit and Delete buttons in the pager. The functionality on the client side will be ready after that. Now you have to implement editing part in the server code only. If you use commercial version of jqGrid like jqSuite you should address to the documentation or demos for more details.
try this
http://www.trirand.net/examples/grid/selection/selectedrow_client/default.aspx
or
Try this
<ClientSideEvents BeforeEditDialogShown="beforeEdit"/>
<script type="text/javascript">
function beforeEdit(rowID) {
var grid = jQuery("#<%= JQGrid1.ClientID %>");
lastSelectedRow = grid.getGridParam("selrow");
};
</script>

Post non editable values in jqGrid?

I'm using jqGrid, and I would like to post non editable values to the server. I'm editing row by row (not form). Is that possible?
The column is visible, and I'm using inline editing. The data is posted using "editurl" property of the grid.
** Solution **
I solved it in a completely different way, by not using jqGrids setCell, but instead setting the textbox value using document.getElementById(selr + "_Verksamhetskod").value = data.
Not exactly what I had in mind initially, but it works...
Just add that to your cell configuration:
editable: true, editoptions: {disabled: true}
Well if I'm understanding correctly you are trying to make a cell become read-only once it has a value but still be in a format where you can post to the server correctly.
You could use Jquery to place a read-only attribute on each input field
$("#PrimaryKey".columnName").attr("disabled", true)
and either fire this code if there is a value in the input field or after an input has been entered.

jqGrid with my custom search

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'] }

Resources