Conditional Rendering and Edit of field based on other 2 field values

edited February 10, 2017 in Questions
Hi All,

I have a requirement to display field (in detail page) with in line edit based on 2 other field values,

Req: 'Title' is a field on detail page, and Created by & Owner are 2 other field's exposed in detail page. While editing the exiting record in detail page (by using Edit button), it should allow user to edit the 'Title' field for current logged in user only if the loggedin user matches with 'created by' or 'owner' field value.

tried by creating 2 duplicate 'title' field's and not able to apply rendering b/w 2 duplicate 'Title' field's based on 2 other field values which are related user info.

Thanks

Comments

  • Matt SonesMatt Sones 💎💎💎
    edited February 10, 2017
    Two options I can think of immediately:
    1. Create a 'RunningUser' model, and make your rendering conditions for the duplicate title fields based on whether the created by and owner fields match the single specified value of {{$Model.RunningUser.data.0.Id}} (the current user id).
    2. Use a custom field renderer to do it quickly with something like this in javascript:
    var field=arguments[0], value = arguments[1], mode = 'read';
    if (field.row.CreatedById === skuid.utils.userInfo.userId) mode = 'edit';
    skuid.ui.fieldRenderers[field.metadata.displaytype][mode](field,value);
  • edited August 24, 2016
    thanks for quick reply Matt...lemme try these options
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!