How to set value of a dynamic field?

edited February 10, 2017 in Questions
Any one know how to set up value to a dynamic field. I have the function where field name would be sent as parameter and I do need to set value there.

Here is an example
function SetValue(params, Name){
$ = skuid.$;
var fieldName =params.model.getField(Name);
// var Mytext = do my task
if(params.model.getRowById(params.row.Id)[fieldName] !== skuid.$('.RichTextField).prop('innerHTML')){            

     params.model.updateRow(params.model.getRowById(params.row.Id),{ fieldName : 'Mytext'});
            skuid.$('.RichTextField div.nx-richtext-input').focus();
        }

}

Comments

  • Matt SonesMatt Sones 💎💎💎
    edited February 10, 2017
    I don't think you need to get the reference to the entire field object. You should be able to just use the field name

    if(params.row[Name] !== skuid.$('.RichTextField').prop('innerHTML')){            

         params.model.updateRow(params.row, Name, 'Mytext');
                skuid.$('.RichTextField div.nx-richtext-input').focus();
            }
  • edited February 9, 2017
    Thanks Matt,
    it works perfect...

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!