ASP.net
Awesome
Learn
Forum
Buy
Demos
Sign In
☾
☀
Switch to
Dark
Light
Mode
this site works best with javascript enabled
Ask Question
Custom display for inline editing
Title:
B
I
{code}
?
I have a grid with inline editing. Depending on the logged user some columns and/or rows have to be read only (both can be combined. Eg : field status can be edited only on rows in which field priority is lower than 2) How can we achieve this ? I had a look in awem.js / function gridInlineEditing and saw the html code used for editing is in column.Tag.Format. But knowing this doesn't help a lot !
Save Changes
Cancel
cram31
asked at 31 Mar 2016
what about creation, can the user create new items without filling the readonly fields ?
at 31 Mar 2016
Omu
Some fields are always readonly and for everyboby even at creation (eg : unique id generated automatically, record creation date, ...). All the others are read/write at creation. Means that the user creating a new record can enter or select values for them. The users with lower rights can not create new records, but as explained in my initial question they can edit some fields on some records (eg : the user responsible for an action can update the progress of this action, but not the due date while another one who is a manager can edit also edit the due date).
at 01 Apr 2016
cram31
Answers
B
I
{code}
?
you can do this to hide the edit button for individual rows new Column { ClientFormatFunc = "EditFormat", Width = 60}, the js func function EditFormat(o) { if (o.Organic) {// you can add other properties to check on in GridModelBuilder.Map return "@Html.Raw(GridUtils.InlineEditFormat())"; } return ''; } to make a column readonly based on a condition known at page render time, you can do this: new Column { Bind = "Name" }.Mod(o => { if(admin) o.Inline(Html.Awe().TextBox("Name")); else o.Inline("<input type='hidden' name='Name' value='#Value'/>#Value"); }), you could also not render the hidden input but you will have to skip validation for this column on the server and ignore the viewmodel value as for making a cell readonly (based on the value/row model) it's not yet possible without changing the mods code, will make it possible in the future and let you know
Save Changes
Cancel
Omu
answered at 01 Apr 2016
Thx for this quick feedback. We will try this.
at 01 Apr 2016
cram31
please
Sign In
to leave an answer
By accessing this site, you agree to store cookies on your device and disclose information in accordance with our
cookie policy
and
privacy policy
.
OK