How to restrict Number Field default value set to '0' in extjs - extjs

I am using Extjs 3.4, I have a grid where I use editor function and form of NumberField type.
Here is my scenario, when the user starts editing a number field and immediately clears it and navigating to next page makes the field value set to '0' with dirty flag set which i dont want.
So, please help me out in having the control over the cell edited and also get the value i updated in the cells.
Thanks in advance,
RK

In ExtJs, when we defined a int field in the model.Its default value is taken as 0.We need to take help of useNull property in field with value as true:
{
name: <fieldName>,
type: 'int',
useNull: true
},

Related

how to store xtype value as String Array CQ5 / AEM

I have dialog with set of xtypes defined.
One of xtype is "selection" with type "select".
Now each option has a value type "String[]" , but when I add the component to a page and look at the option selected content.
It is stored as "String" rather than "String[]".
Could anyone tell me how to make/force a xtype store its values in a "String[]" , rather than "String".
You can use one of the Sling parameters to manipulate the content creation through the SlingPostServlet. Read more: here
In reality, just add a hidden field to your dialog that will pass the #TypeHint parameter with the expected property type. If your xtype saves data to e.g. cities property you can add the following:
<citiesTypeHint
jcr:primaryType="cq:Widget"
name="cities#TypeHint"
value="String[]"
xtype="hidden"
When you are adding xtype in dialog.xml, add it as :
property=value
This will create a property of String type with value as value.
If you want an array put the value in [], as :
property="[value1,value2,value3,...]"
This will create a property of String[] type with value as value. If you want to add more, separate then with coma.
If you want to define dataType, as :
property="{dataType}value"
This will create a property of dataType type with value as value. Where dataType may be any DataType like Boolean, Date, Long, etc
If you are adding Property with crx/de then click on add multi button in the bottom right corner.
Hope this Helps...:)
Mateusz ChromiƄski variant almost worked for me, except that value="String[]" results in emprty property, so I have used defaultValue="String[]" and it worked just perfect.
<targetGroupsTypeHint
jcr:primaryType="cq:Widget"
name="./targetGroups#TypeHint"
defaultValue="String[]"
xtype="hidden"/>
Enter the following in the dialog:
typeHint="String[]"

How to access to a Combo box value in Item Line on NetSuite?

In NETSUITE
is there any way to access to a value inside of a combo-box at the item line level?
I need to access to a value after inserting an item but all functions get me null value.
I have tried
nlapiGetCurrentLineItemValue
and
nlapiGetFieldValue
Both functions are getting me null values.
Thanks,
Pablo.
In general (for user event and client script) below code should work
nlapiGetLineItemValue(LINE_ITEM_TYPE, YOUR_FIELD_ID, LINE_NUMBER);
eg on SO to get the line item Id:
nlapiGetLineItemValue('item', 'item', 1);
PS: Syntax is independent of data type or field type
If you mean combo box as a mulitselect, and if you're trying to access via User Event Script, use:
nlapiGetLineItemValues(type, fldname, linenum);
Note the 's' in nlapiGetLineItemValues
If its just a standard field, nlapiGetLineItemValue(type, fldname, linenum) should work.
Which call to use depends on what event you are capturing.
For instance if you are trying to access the value in a post sourcing, field changed or line validate event of a client script you would use nlapiGetCurrentLineItemValue('item', 'fieldname');

ExtJS 5: How do I include text after a numberfield?

Just about every field has a fieldLabel and a boxLabel config to set text either before or after the field. However, number field just happens to be one of them that does not. Is there anyway I can set text after a number field?
Example:
[ 1 ^] text goes here
Looks like this did the trick
afterSubTpl: 'this is after'
However it appears below the numberfield instead of directly to the right.
And this
beforeSubTpl: 'this is before'
puts the text above it, instead of to the left.
Working seeing if this can be fixed with styling.

Setting a value to a combobox - EXTJS - BEGINNER

I am trying to set a value to a combobox, and the code is as follows:
The problem i am getting it is that the value isn't getting set.
var t= Ext.ComponentQuery.query('#WindowID> #formId> #comboID')[0];
t.setValue('SOME v');
I also tried setText, there was no use.
If you want to set the value directly, try using
combo.setRawValue('SOME VALUE')
but be aware that this bypasses value conversion, change detection, and validation.
Visit http://docs.sencha.com/extjs/4.2.2/#!/api/Ext.form.field.ComboBox-method-setRawValue

ExtJS - second combo-box not getting populated after choosing first one

I have two dependent combo-boxes and the value of second one is populated after some value in the first has been selected.
For this, I am using setValue for the second combo-box at the select event of first one.
Below are the two cases of code, here case 1 doesn't work but case 2 works in IE9:
Case1: This doesn't work
select:function(combo, record){
Ext.getCmp('voyageMonitoritngVesselCode').store.load();//Loading the store of second combobox
Ext.getCmp('voyageMonitoritngVesselCode').setValue(record[0].data.vslCd);//Setting the value in the second combo-box
}
Case2: This works
select:function(combo, record){
Ext.getCmp('voyageMonitoritngVesselCode').store.load();//Loading the store of second combobox
alert(record[0].data.vslCd);//The only difference in both cases is this line
Ext.getCmp('voyageMonitoritngVesselCode').setValue(record[0].data.vslCd);//Setting the value in the second combo-box
}
That is, when I write an alert statment between loading of store and setting the value, then the values gets displayed in the second combobox, but if I omit this alert then there is no value set in the combobox.
I felt that probably the store needs time to load and it could be getting this time from the alert message halt. But as a solution for this, I used autoload:true for the second combo, so that the store doesn't have to be loaded but still the case was same - the value was not getting set without alert.
Could anyone please throw some light at this.
Browser - IE9
ExtJS - 4
Thanks in Advance.
The second doesn;t work because the load is an asynchron request meaning that the store is not loaded yet when you trie to set value, setting an alert before it gives it enough tme to load it ... a quick fix would be:
var combo = Ext.getCmp('voyageMonitoritngVesselCode');
combo.store.load({
callback:function(r, options, success) {
combo.setValue(record[0].data.vslCd);
}
});

Resources