Table : Field becoming read only after editing it

  • 2
  • Problem
  • Updated 3 years ago
  • (Edited)
we have a java script in field on a table. In this Field we are displaying different fields based on some pick list values.Before It was working fine .

when ever we tried to edit the this field its becoming readonly after editing it which was not happening before. Please find the code below :

var $ = skuid.$,    model = arguments[0].model,
    row = arguments[0].row ,
    element = arguments[0].element;
    var valueType = model.getFieldValue( row , 'Data_Type__c' );

function renderField( fieldName,defaultValue ){
    var field = new skuid.ui.Field( row, model, null, { fieldId: fieldName, register: true } ),
        value = model.getFieldValue( row , fieldName ) ||defaultValue;
        console.log( field, value );
        if(field && field.metadata && field.metadata.displaytype ){
            //skuid.ui.fieldRenderers[field.metadata.displaytype][field.mode]( field, value );
            console.log( fieldName + ' rendered!', field.element );
            skuid.ui.fieldRenderers[field.metadata.displaytype].edit( field, value );
        }
    return field.element;
}


switch ( valueType ){
    case 'Extended Amount':
         element.append(
            //$('<span>').text(' Qty: '),
            
            renderField( 'Quantity__c' ,''),
          //  $('<span>').text(' Unit: '),

            renderField( 'Unit__c','' ),
          //  $('<span>').text(' Rate: '),

            renderField( 'Rate__c','' ),
          //  $('<span>').text(' Total: '),

            renderField( 'Total__c' ,'') );
        break;

}
Photo of soundar raja

soundar raja

  • 238 Points 100 badge 2x thumb
  • sad

Posted 3 years ago

  • 2
Photo of Trey Alexander

Trey Alexander

  • 222 Points 100 badge 2x thumb
As added clarification, we've attempted to configure a custom field renderer that renders a certain in table row based on the value of another field. For some reason, when a value is keyed into the rendered field, about 2 seconds after the last keystroke, the field becomes read-only (i.e. non-editable; italicized in yellow)--see screenshot. How can we modify the code to prevent this from happening?
Photo of Andy Forbes

Andy Forbes

  • 322 Points 250 badge 2x thumb
Soundar - Please file a ticket with Skuid support as well. This issue is putting the release schedule at risk. Thanks!
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
We'll get back to you guys this morning on this.  I don't think further escalation is necessary. 
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
A few questions: 

1. What version of Skuid are you running?
2. Do you have any other components tied to this model and fields?  (We've especially found this to be a problem when you have a template component with an iFrame tied to the same model where you are doing data entry.  In this case the iFrame rerenders on any data change - which resets that field...
3. It doesn't look like the full code is copied above.  There is only one case in your switch statement. 
4. What is the default mode of the table? Is it read only by default? 
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
Would you mind giving us login rights to your org so we can take a look at what is going on?   Here is how: 

1. Use this tutorial to give us login rights: http://help.skuidify.com/m/getting-started/l/182412-getting-help-how-to-grant-skuid-login-rights-to-your-org


2. Then send an email to support@skuidify.com  with the following information: 


- Your org Id 

- The name of the page where the problem is happening 

- The steps required to reproduce the problem.  

We’ll see what’s going on...
Photo of soundar raja

soundar raja

  • 238 Points 100 badge 2x thumb
Yes we can do that.thanks
Photo of Ben Hubbard

Ben Hubbard, Employee

  • 12,470 Points 10k badge 2x thumb
Changing this line in your snippet...

var field = new skuid.ui.Field( row, model, null, { fieldId: fieldName, register: true } ),

to...

var field = new skuid.ui.Field( row, model, null, { fieldId: fieldName, register: true, mode: 'edit' } ),

should fix your issue.
Photo of soundar raja

soundar raja

  • 238 Points 100 badge 2x thumb
Thanks. it resolved the issue.