0

I am developing a grid that contains a list of permits per module.

What I want is to validate every 2 events when a change is made in a combobox in a column. I'm using 1 and 0 for activating / deactivating

The first case: If I active "write", "modify", "delete" or "print" means that self-select "read"

enter image description here

The second case is the opposite: If you disable "Read" will turn off automatically "write", "modify", "delete" and "print"

enter image description here

Researching I found the option to use functions of input events:

{"name":"read",
"index":"read",
"width":48,
"resizable":false,
"editable":true,
"edittype":"select",
"editoptions":{
  "value":"0:0;1:1",
  "dataEvents":[{
               "type":"change",
                "fn":function(e){
                     if($(e.target).val() == '0')
                     {
                     // actions here...
                     }
                 }
               }]
 }
}

You can change the elements of the other columns ... by row?

EDIT

my solution:

$('tr.jqgrow select[name*="read"]').live("change",function()
{   
    if($(this).val() === '0') $(this).closest('tr.jqgrow').find('select.editable').not(this).find('option:first-child').attr("selected", "selected");
});

$('tr.jqgrow select[name!="read"]').live("change",function()
{
    $(this).closest('tr.jqgrow').find('select[name*="read"]').find('option:last-child').attr("selected", "selected");
});
csotelo
  • 1,453
  • 2
  • 28
  • 43

1 Answers1

0

In the answer you will find an example how to implement dependent selects in jqGrid. By the way you can use the same idea with formatter: "checkbox". In the case the implementation will be much easier. It's important that you have to modify the <select> elements or chachboxes manually.

One more answer can you show another implementation option which you can use.

Community
  • 1
  • 1
Oleg
  • 220,925
  • 34
  • 403
  • 798
  • Thanks for your response, I read the topic on countries and states ... but I see that the code used is very wide, would also have to copy the same function in each field for the second case that I posted. I edited my question with my own solution that works for my needs. Thanks – csotelo Jul 07 '12 at 15:49
  • @csotelo: I wrote you that in your case the solution will be much easier. Important is only that you have change the ` – Oleg Jul 07 '12 at 16:10
  • @csotelo: all selects of inline editing has ids which will be constructed like `3_read` where `3` is the rowid and `'read'` is the `name` from the column. Alternatively you can search the select by attribute `name="read"`. It will be code more readable and independent to small modification of the `colModel` (like inserting of new column or the usage of `rownumbers:true` option). – Oleg Jul 07 '12 at 16:16
  • ok, I will continue to investigate a related solution and edit my answer – csotelo Jul 07 '12 at 17:30
  • Hi, I have changed the functions with selectors that refer to the id of selection lists. Maybe these same logic can be used for each combobox columns. You can use an external function in dataEvents? Where I can use something similiar to my solution? – csotelo Jul 07 '12 at 23:38