Home › Forums › Guriddo jqGrid JS › Help › How to disable the publishing of some lines ?
Hello,
I wish I could turn off the editing of certain income line.
I have a hidden field: editon = 0/1
But I do not see how to tell jqGrid block Edion as certain line after the condition.
I have no idea how to do.
Someone has already done this?
Hello,
Not sure I understand the questions. Could you please be a more detailed.
Hidden fields, by default are not editable. If you want to edit some hiddeen field you may need to use the properly in editoptions edithidden:true.
To make a field not editable just set in colModel the property editable: false.
Kind Regards,
Hello,
I have a jqGrid with a list of results (row).
I want the user has the right to modify some lines.
To see which line has the right to change, I have a column Right: 0/1
I hope to be more clear?
Hello,
In inline edit you should add class “not-editable-row” in form edit you should add class “ui-state-disabled” for jQueryUI and “ui-disabled” when using bootstrap.
The class should be added to the row. Use for this purpose rowAttr event in grid options.
Kind Regards,
Will
Guriddo Support Team
<span id=”result_box” class=”” lang=”en”>Hello,</span>
Thank you for the slopes.
For now I hide the publishing bottom of the table buttons, the concern is that I losque changes in the modal box there next previous boom, and it is possible to go change those not Authorized …
I wondered if there was not a function to say that a given line is not editable?
(Recess server side is checked, but it is cleaner to not have as client-side <span class=””>access)</span>
beforeSelectRow: function (rowid) {
var selRowId = $(this).getGridParam(‘selrow’),
tr = $(this.rows.namedItem(rowid)),
thisId = $.jgrid.jqID(this.id),
rowData = $(this).jqGrid(‘getRowData’, rowid);
console.log(rowData.Editable);
if (selRowId !== rowid && rowData.Editable==0) {
// eneble the “Edit” button in the navigator
$(“#edit_” + thisId).hide();
$(“#del_” + thisId).hide();
} else {
// unselect previous selected row
// disable the “Edit” and “Del” button in the navigator
$(“#edit_” + thisId).show();
$(“#del_” + thisId).show();
}
return true; // allow selection or unselection
},
Hello,
As I say in may previous post if you set desired rows with the class ui-state-disabled, the rows are not editable. The small function in this case is easy to be written.
|
1 2 3 |
function isEditable( rowid ) { return $("#rowid").hasClass("ui-state-disabled") ? true : false; } |
where the rowid is the id of the row.
Note that in this case the navigator buttons are disable autoamtically when you select the row with this class.
All you need is to set the desired class depending on your data
Regards
Will
Guriddo Support Team
Hello,
Thank you for the example, it works, non-editable lines are no longer “selectable”.
By cons when I take an editable line, I click the edit button, the pupup opens then there are the buttons, next, previous, which also allow access to non-editable lines. Is there a trick?
beforeSelectRow: function (rowid) {
var selRowId = $(this).getGridParam(‘selrow’),
if (selRowId !== rowid && rowData.Editable==0) {
$(rowid).addclass(“ui-state-disabled”);
}
return true;
},
Thank you
Hello,
This behaviour is by default. I think you do something wrong. Records with ui-state-disabled are not selectable and not editable. Also the navigator button is disabled too if the next record is disabled.
See demo here
Kind Regards,
Will
Guriddo Support Team
Hello,
So if I followed just add this command:
styleUI : ‘Bootstrap’,
rowattr : function( rd, curr, id ) {
if(rd.Editable == 0 ) {
return {class : ‘ui-state-disabled’};
}
},
In the list of results it works. By cons in the pop-up that does not work.
Perhaps the bootstrap release?
Hello,
Dear @cvneo it seems to me you do not have carefully read my posts. The solution is in some of my previous posts – you just need to read them.
Regards,
Will
Guriddo Support Team
Hello,
I read everything and do the test in every way and it does not work.
In the demo link it works and I tested the same way but nothing to do … may be the bootstrap version of poses concern?.
I would do a test with no bootstap installation to see.
Nothing in the popup buttons are still active on the elements with the ui-state-disabled class on the Row.
Hello,
So this is not enough?
rowattr: function (rd, curr, id) {
if (rd.Editable == 0) {
return {class ‘ui-state-disabled’};
}
},
May be easier with a little example because I do not see what to add.
Sorry JS is not my favorite 🙂
Kind Regards,
Chris
”
In inline edit you should add class “not-editable-row” in form edit you should add class “ui-state-disabled” for jQueryUI and “ui-disabled” when using bootstrap.
“
Guriddo Support Team
Copyright 2014 TriRand LtdAll Rights ReservedRSS
Back to Top