Angular-xeditable - Editable Row - Change Value - angularjs

I try to set a value of a select control to null when a checkbox is unchecked.
I try with onbeforesave and onaftersave but i want to do it dynamicly , so i used e-ng-change. I want also to not change the value if i cancel my changes but i can't access to the control value.
You can see the code here : http://jsfiddle.net/NfPcH/2833/
In normal forms, i set the value like this but here i don't have any know access
sco.editableForm.name.$setViewValue("1234")
Regards,
Marc

I found a solution of my problem to set value in editable mode :
sco.rowform.$editables[2].scope.$data = null;

Related

Update form field value dynamically

I need to update the form field value using javascript as below:
var frmRec = App.frmEdit.getRecord();
frmRec.set('CallingName', 'Tesing calling name');
When I check the form data via the console, I can see the calling name field is updated:
console.log('rec: ', App.frmEdit.getRecord());
But the textfield in the form is not updated, old values still show up in the form. How can I "refresh" the value of the TextField in this case ?
Thanks in advance
If your data binding is setup correctly there is no need to refresh anything. The Extjs form supports two-way binding change to the record would be reflected in the text field and any change to the text field would be updated in the record.
two way binding example
The kitchen sink examples have lots of data binding examples.

Reset a ComboBox

I have a view that contains several ComboBox elements. For some reason old data remains from the previous time the view was opened and I would like to reset the combobox elements in the view every time it is opened. Is there a function that could that for me? I want it to be exactly how it is as if I rendered it the first time with the initial items. Would using setSelectedItem(vItem), setSelectedItemId(vItem), setSelectedKey(sKey), setShowSecondaryValues() help? If so, what do these keywords mean (selectedItem, selectedItemID, selectedKey, secondaryValues)?
Unfortunately you do not provide an example. Normally you bind your UI controls against a model, e.g. JSONModel. In this case the items of your ComboBox controls would be taken from the corresponding model. However, you can use method removeAllItems to achieve the desired behaviour.
UPDATE: Obviously the controls are bound and only the selection should be cleared.
Use setSelectedItem with value null to clear the selection. You could also use the binding to set the selected item automatically by using the selectedKey attribute, see example.

BarEditItem1, what is the code to access to a combox item

In my form I have a Barmanager, in which I have a comboboxedit1. I want to know how to access to the selected item of the baredititem1 (combobox). In the normal combobox it is:
dim q =combobox1.selecteditem
but I can't do the same in a baredititem1 wgich is placed in a barmanager.
You can grab the current selected value using the barEditItem1.EditValue property, or while the editor is activated, you can access the current editor instance by BarManager.ActiveEditor property, which you should cast to ComboBoxEdit in your case. You can read about this more in the documentation, where they explain why you cannot access the concrete editor anytime you want.

ExtJS ComboBox if forceselection true keep typed value

I have a combobox with force selection true. when user types an arbitrary value it clears the value when validating. I need to know how to keep the invalid value that user entered while displaying its invalid. Like alternative forceSelection.
Thanks. Hopes an immediate help.
Found a result for this and it works perfectly.
ExtJS findExact() and custom validator bug

Default value for ExtJs Combo box without using emptyText

I'm using ExtJs 4 and in my Web application I have a combo box. Previously I used to set the default value of the combo box using emptyText. It works just fine. But, is there any alternative way of setting the default value for the same?
I looked into different questions here on SO and tried the following -
Ext.getCmp('myComboBoxID').setValue("myValue");
However, this doesn't seem to be working. I also tried the simple value attribute to no avail. How can I the set the default value other than using emptyText?
Also, when the value is set using emptyText, it is displayed in gray color (which is poorly vsible), I was wondering if one can work with the opacity of the ExtJs select box?
Update: I used Ext.getCmp('myComboBoxID').setRawValue("myValue"); to set the value & it worked. What is the difference between setValue() & setRawValue()?
You need to supply the id to getCmp method. Try the following.
Ext.getCmp('#myComboBoxID').setValue("myValue");
I used Ext.getCmp('myComboBoxID').setRawValue("myValue"); to set the value & it worked.
The store needs to be loaded before you call setValue and you use the id of the record you want to select. There is a load event you can listen for if the values are loaded from the server. emptyText is not intended for default values, but to help the user understand what should be done with the field (eg "Select a state" from a list of states)

Resources