Results 1 to 2 of 2

Thread: issue using a field with depends property

    Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Ext JS Premium Member
    Join Date
    Aug 2011
    Greenville, SC

    Default issue using a field with depends property

    This is a lot to take in because this issue is deep down inside ext, but please look through the fiddle and my notes in the additional information section.

    Ext version tested:
    • Ext 6.0.1

    Browser versions tested against:
    • Chrome 48.0.2564.116 m (64-bit)

    • When dynamically adding a field to a model, any field using a depends is not update correctly.

    Steps to reproduce the problem:
    • Define a class using a field which has the 'depends' property configured with another field.
    • Create an instance of the model with data.
    • Add a field to the model by using model.self.addFields and set a value.
    • Set the value of the field which is depended on.

    The result that was expected:
    • The field with the depends should be update with the value of the field it depends on.

    The result that occurs instead:
    • The value is not updated.

    Additional Information:

    Here is a link to the fiddle:

    When the addFields is called (which calls the replaceFields static), the rankedFields, transientFields, criticalFields, and initializeFn are reset, but the fields themselves have a "rank" property which is not reset. As per the fiddle, when we call the set function to add a value to the newly created field, there is a call to "rankedFields = cls.rankFields();" to get the list of fields. The field.rank property is set for fields which do not have the depends and the field which has depends is pushed to a transientField array:

    for (i = 0; i < length; ++i) {
    	field = fields[i];
    	if (field.critical) {
    	if (!field.persist) {
    	if (field.evil) {
    		(evilFields || (evilFields = [])).push(field);
    	} else if (!field.depends) {
    		field.rank = rankedFields.length; // 1-based

    At this point, you can potentially have 2 fields with the same rank. The transient field has the same rank from the initial creation and the new field will have the same value as the transient field. This is because the new field has the array position of the transientField. Here is where things go south:

    	for (i = 0; i < length; ++i) {
    		if (!(field = fields[i]).rank && !field.evil) {

    This section of code handles adding the transientField to the rankedFields. If you notice, there is a rank check and because the rank was not reset the transientField is not added to the rankedField and ultimately the data is not update through the depends. If you add a debugger to the above code, you can see both the field with the depends and the last field added have the same rank number.

  2. #2
    Ext JS Premium Member
    Join Date
    Aug 2011
    Greenville, SC


    Can you please take a look at this?

Similar Threads

  1. Replies: 2
    Last Post: 9 Mar 2017, 7:31 AM
  2. Replies: 2
    Last Post: 17 Jul 2015, 4:43 PM
  3. Model field property defaultValue set to undefined is ignored
    By michal.ciasnocha in forum Ext 5: Bugs
    Replies: 3
    Last Post: 18 Jun 2015, 3:21 AM
  4. Set property convert to null for a field in Model
    By djengel79 in forum Sencha Architect 2.x: Help & Discussions
    Replies: 0
    Last Post: 30 Jul 2013, 6:05 AM
  5. access a model property from a field convert function
    By macs in forum Sencha Touch 2.x: Discussion
    Replies: 3
    Last Post: 11 Sep 2012, 6:09 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts