extendsFrom: 'RecordView',Rolustech: SugarCRM Engineering
initialize: function(options) {
this.plugins = _.union(this.plugins || [], ['HistoricalSummary']);
this._super('initialize', [options]);
this.model.on("change:is_show_c",this.CustomOnChange, this);
},
CustomOnChange: function(){
var is_show_c1=this.model.get('is_show_c');
if (is_show_c1 == "No")
$('[data-name="testfield_c"]').hide();
else
$('[data-name="testfield_c"]').show();
},
// is_show_c is the multi select field
// testfield_c is the text field
({ extendsFrom: 'RecordView',
initialize: function(options) {
this._super('initialize', [options]);
/*OnChange on multi-select fields for scoring*/
this.model.on("change:scoring_2_roues_c",this.Change2Roues, this);
},
Change2Roues: function(){ if (_.indexOf(this.model.get('scoring_2_roues_c'), "sautr") == -1){
$('[data-name="detail_scoring_2_roues_c"]').hide(); //Autres n'est pas sélectionné
}else{
$('[data-name="detail_scoring_2_roues_c"]').show(); //Autres est sélectionné
}
},
})
this.on("render", this.<function_name>, this);Best Regards,
By putting the render, and by copying my code in create-actions.js, i finally did it ! My final code in the next response :)
({ extendsFrom: 'RecordView',
initialize: function(options) {
this._super('initialize', [options]);
this.on("render", this.displayFunction, this);//launch it whenever your page is rendered
this.model.on("change:YourMultiSelect",this.displayFunction, this);//display changes when the multi select change
},
displayFunctiondisplayDetailsScoring:function(){
if (_.indexOf(this.model.get('YourMultiSelect'), "others") === -1){
$('[data-name="YourTextField"]').hide();
}else{
$('[data-name="YourTextField"]').show();
}
},
})
({ extendsFrom: 'RecordView',
({ extendsFrom: 'CreateActionsView',
Sorry if it seems out of place , thought to keep the discussion linked since I'm building on this.
Anyone figured out how to style things as closely as possible to sugarcrm default behaviour ( dependent field ) . for .show and hide ?
Tried multiple things such as addClass("hide") instead of .hide and removeClass("hide").
, searched the style guide but couldn't find it. Basically the rows will collapse and the other field will take full width if there's more than 1 on the same row and one of them shows as hidden. This doesn't happen on dependent fields. Recordit: Record screencasts fast & free! with GIF Support!
UPDATE
It seems to be the vis_action_hidden class so my code now looks something like : However can't get that pink coloured fade-in effect.
if(this.model.get('objectifs_c').contains("12") ) { //programation action commerciale $('[data-name="v_liste_actionco"]').removeClass("vis_action_hidden"); } else { $('[data-name="v_liste_actionco"]').addClass("vis_action_hidden"); }
Sorry if it seems out of place , thought to keep the discussion linked since I'm building on this.
Anyone figured out how to style things as closely as possible to sugarcrm default behaviour ( dependent field ) . for .show and hide ?
Tried multiple things such as addClass("hide") instead of .hide and removeClass("hide").
, searched the style guide but couldn't find it. Basically the rows will collapse and the other field will take full width if there's more than 1 on the same row and one of them shows as hidden. This doesn't happen on dependent fields. Recordit: Record screencasts fast & free! with GIF Support!
UPDATE
It seems to be the vis_action_hidden class so my code now looks something like : However can't get that pink coloured fade-in effect.
if(this.model.get('objectifs_c').contains("12") ) { //programation action commerciale $('[data-name="v_liste_actionco"]').removeClass("vis_action_hidden"); } else { $('[data-name="v_liste_actionco"]').addClass("vis_action_hidden"); }