Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    displayField + filtering not working?

    I am not 100% sure if this is a bug or if it is our setup - we are using displayField for when we send over integer values that are formatted on the server to be comma separated. But as soon as we introduced this, our filtering stopped working.

    Run the testcase and type 55.33 in the filter field for dec_TF then press the filter button. The data is not filtered.

    Code:
    var myData = [
    
     
    
    {cwPK__:0, dec_RBH: 22, dec_TF: 55.33, $cwdec_TF: 55.33,str_TF: "ZZZZZZZ"},
    
    {cwPK__:1, dec_RBH: 33, dec_TF: 15.66, $cwdec_TF: 15.66,str_TF: "asdasdasd"},
    
    {cwPK__:2, dec_RBH: 33, dec_TF: 14.77, $cwdec_TF: 14.77,str_TF: "asdasdZ"},
    
    {cwPK__:3, dec_RBH: 33, dec_TF: 55.33, $cwdec_TF: 55.33,str_TF: "hergeZZZ"},
    
    {cwPK__:4, dec_RBH: 22, dec_TF: 55.33, $cwdec_TF: 55.33,str_TF: "sdfssZZ"},
    
    {cwPK__:5, dec_RBH: 99, dec_TF: 14.77, $cwdec_TF: 14.77,str_TF: "sdfsdf"},
    
    {cwPK__:6, dec_RBH: 22, dec_TF: 15.66, $cwdec_TF: 15.66,str_TF: "asdasd1231ZZ"},
    
    {cwPK__:7, dec_RBH: 22, dec_TF: 14.77, $cwdec_TF: 14.77,str_TF: "asdasd"},
    
    {cwPK__:8, dec_RBH: 99, dec_TF: 55.33, $cwdec_TF: 55.33,str_TF: "asdasd"},
    
    {cwPK__:9, dec_RBH: 22, dec_TF: 14.77, $cwdec_TF: 14.77,str_TF: "dwqeZ"}
    
    ];
    
     
    
     
    
    isc.DataSource.create({
    
                   ID:"orderItemLocal2",
    
                   clientOnly: true,
    
                   testData: myData,
    
                   fields:[{name:"cwPK__",primaryKey:true, hidden:true},{name:"dec_RBH"},{name:"dec_TF"},{name:"str_TF"}],
    
                   showPrompt:false,criteriaPolicy:"dropOnChange",compareCriteria:function() { return 1; }});
    
     
    
    isc.VStack.create({
    	ID:"table_AA",
    	name:"table",
    	height:"100%",
    	width:"100%",
    	members:[
    		isc.ListGrid.create({
    			fastCellUpdates:false,
    			groupStartOpen:"first",
    			dataSource:orderItemLocal2,
    			validateOnChange:true,
    			dataProperties:{
    				useClientFiltering:false,
    				neverDropUpdatedRows:true
    			},
    			ID:"GridFilterResultTable1",
    			showFilterEditor:true,
    			modalEditing:true,
    			canSelectText:true,
    			selectOnEdit:true,
    			willHandleErrors:true,
    			autoFetchData:true,
    			canSort:true,
    			headerButtonProperties:{wrap:true},
    			emptyMessage:"No items found.",
    			fields:[{title:"<nobr>Decimal - Radio Button - Horizontal&nbsp;<\/nobr>",
    				valueMap:{"22":"22","33":"33","99":"99"},
    				filterEditorType:"text",filterEditorValueMap:{},
    				filterEditorProperties:{required:false,validateOnChange:false},
    				name:"dec_RBH",align:"left",validateOnChange:true,width:"100"
    				},
    				{title:"<nobr>Decimal - Text Field&nbsp;<\/nobr>",
    				type:"decimal",displayField:"$cwdec_TF",
    				sortByDisplayField:false,
    				neverValidate:true,
    				validateOnChange:false,
    				filterEditorProperties:{_constructor:"TextItem",
    				name:"dec_TF",align:"left",width:"100"}
    				},
    				{title:"<nobr>String - Text Field&nbsp;<\/nobr>",editorType:"text",
    				neverValidate:true,
    				validateOnChange:false,
    				filterEditorProperties:{_constructor:"TextItem",required:false,validateOnChange:false,type:"text",changed:function() { return true; }},
    				name:"str_TF",
    				align:"left",
    				width:"100"
    				}],
    		canEdit:false})
    	]});

    #2
    By default criteria that do not match a specified field in the dataSource are dropped. Can you add an explicit $cwdec_TF field to the dataSource? (This would seem to make sense since, if we understand your use case, the values for this field are being populated on the server - it's not a field that's calculated at runtime on the client, etc)

    Comment


      #3
      OH ok - if we specify display fields, they have to be part of the datasource fields as well? Will try that - makes sense.

      Comment


        #4
        Doesn't seem to have made a difference

        Code:
        
        var myData = [
        
         
        
        {cwPK__:0, dec_RBH: 22, dec_TF: 55.33, $cwdec_TF: 55.33,str_TF: "ZZZZZZZ"},
        
        {cwPK__:1, dec_RBH: 33, dec_TF: 15.66, $cwdec_TF: 15.66,str_TF: "asdasdasd"},
        
        {cwPK__:2, dec_RBH: 33, dec_TF: 14.77, $cwdec_TF: 14.77,str_TF: "asdasdZ"},
        
        {cwPK__:3, dec_RBH: 33, dec_TF: 55.33, $cwdec_TF: 55.33,str_TF: "hergeZZZ"},
        
        {cwPK__:4, dec_RBH: 22, dec_TF: 55.33, $cwdec_TF: 55.33,str_TF: "sdfssZZ"},
        
        {cwPK__:5, dec_RBH: 99, dec_TF: 14.77, $cwdec_TF: 14.77,str_TF: "sdfsdf"},
        
        {cwPK__:6, dec_RBH: 22, dec_TF: 15.66, $cwdec_TF: 15.66,str_TF: "asdasd1231ZZ"},
        
        {cwPK__:7, dec_RBH: 22, dec_TF: 14.77, $cwdec_TF: 14.77,str_TF: "asdasd"},
        
        {cwPK__:8, dec_RBH: 99, dec_TF: 55.33, $cwdec_TF: 55.33,str_TF: "asdasd"},
        
        {cwPK__:9, dec_RBH: 22, dec_TF: 14.77, $cwdec_TF: 14.77,str_TF: "dwqeZ"}
        
        ];
        
         
        
         
        
        isc.DataSource.create({
        
                       ID:"orderItemLocal2",
        
                       clientOnly: true,
        
                       testData: myData,
        
                       fields:[{name:"cwPK__",primaryKey:true, hidden:true},{name:"dec_RBH"},{name:"dec_TF"},{name:"$cwdec_TF"},{name:"str_TF"}],
        
                       showPrompt:false,criteriaPolicy:"dropOnChange",compareCriteria:function() { return 1; }});
        
         
        
        isc.VStack.create({
        	ID:"table_AA",
        	name:"table",
        	height:"100%",
        	width:"100%",
        	members:[
        		isc.ListGrid.create({
        			fastCellUpdates:false,
        			groupStartOpen:"first",
        			dataSource:orderItemLocal2,
        			validateOnChange:true,
        			dataProperties:{
        				useClientFiltering:false,
        				neverDropUpdatedRows:true
        			},
        			ID:"GridFilterResultTable1",
        			showFilterEditor:true,
        			modalEditing:true,
        			canSelectText:true,
        			selectOnEdit:true,
        			willHandleErrors:true,
        			autoFetchData:true,
        			canSort:true,
        			headerButtonProperties:{wrap:true},
        			emptyMessage:"No items found.",
        			fields:[{title:"<nobr>Decimal - Radio Button - Horizontal&nbsp;<\/nobr>",
        				valueMap:{"22":"22","33":"33","99":"99"},
        				filterEditorType:"text",filterEditorValueMap:{},
        				filterEditorProperties:{required:false,validateOnChange:false},
        				name:"dec_RBH",align:"left",validateOnChange:true,width:"100"
        				},
        				{title:"<nobr>Decimal - Text Field&nbsp;<\/nobr>",
        				type:"decimal",displayField:"$cwdec_TF",
        				sortByDisplayField:false,
        				neverValidate:true,
        				validateOnChange:false,
        				filterEditorProperties:{_constructor:"TextItem",
        				name:"dec_TF",align:"left",width:"100"}
        				},
        				{title:"<nobr>String - Text Field&nbsp;<\/nobr>",editorType:"text",
        				neverValidate:true,
        				validateOnChange:false,
        				filterEditorProperties:{_constructor:"TextItem",required:false,validateOnChange:false,type:"text",changed:function() { return true; }},
        				name:"str_TF",
        				align:"left",
        				width:"100"
        				}],
        		canEdit:false})
        	]});

        Comment


          #5
          Oh - we also found we had to set an explicit 'name' on the field - if you set name to "dec_TF" your example works.

          However, you should be aware that in this case, when the user enters criteria such as "55.33" the filter criteria generated is against $cwdec_TF, not against dec_TF.
          We're not entirely sure whether you're intending this or whether you wanted to filter against the dec_TF field?

          In concrete terms, if, for some record, dec_TF contains 5000.20, but $cwdec_TF would contain "5,000.20", the current implementation would display "5,000.20" to the user, and the user would have to enter that same string to get back results.
          If your intention was to have the user be able to enter just "5000.20" you'd want to be filtering against the dec_TF field.

          If this is what you're after, you could achieve this by explicitly setting the "criteriaField" attribute to "dec_TF" on the filterEditorProperties on the field.

          (If you're after something else entirely let us know and we'll try to steer you in the right direction!)

          Comment


            #6
            Originally posted by Isomorphic

            In concrete terms, if, for some record, dec_TF contains 5000.20, but $cwdec_TF would contain "5,000.20", the current implementation would display "5,000.20" to the user, and the user would have to enter that same string to get back results.
            If your intention was to have the user be able to enter just "5000.20" you'd want to be filtering against the dec_TF field.

            If this is what you're after, you could achieve this by explicitly setting the "criteriaField" attribute to "dec_TF" on the filterEditorProperties on the field.
            Yup this is exactly what I want to achieve. I only want $cwdec_TF for display purposes. Thanks for the assistance!

            Code:
            
            var myData = [
            
             
            
            {cwPK__:0, dec_RBH: 22, dec_TF: 5555.33, $cwdec_TF: "5,555.33",str_TF: "ZZZZZZZ"},
            
            {cwPK__:1, dec_RBH: 33, dec_TF: 15.66, $cwdec_TF: 15.66,str_TF: "asdasdasd"},
            
            {cwPK__:2, dec_RBH: 33, dec_TF: 14.77, $cwdec_TF: 14.77,str_TF: "asdasdZ"},
            
            {cwPK__:3, dec_RBH: 33, dec_TF: 55.33, $cwdec_TF: 55.33,str_TF: "hergeZZZ"},
            
            {cwPK__:4, dec_RBH: 22, dec_TF: 55.33, $cwdec_TF: 55.33,str_TF: "sdfssZZ"},
            
            {cwPK__:5, dec_RBH: 99, dec_TF: 14.77, $cwdec_TF: 14.77,str_TF: "sdfsdf"},
            
            {cwPK__:6, dec_RBH: 22, dec_TF: 15.66, $cwdec_TF: 15.66,str_TF: "asdasd1231ZZ"},
            
            {cwPK__:7, dec_RBH: 22, dec_TF: 14.77, $cwdec_TF: 14.77,str_TF: "asdasd"},
            
            {cwPK__:8, dec_RBH: 99, dec_TF: 55.33, $cwdec_TF: 55.33,str_TF: "asdasd"},
            
            {cwPK__:9, dec_RBH: 22, dec_TF: 14.77, $cwdec_TF: 14.77,str_TF: "dwqeZ"}
            
            ];
            
             
            
             
            
            isc.DataSource.create({
            
                           ID:"orderItemLocal2",
            
                           clientOnly: true,
            
                           testData: myData,
            
                           fields:[{name:"cwPK__",primaryKey:true, hidden:true},{name:"dec_RBH"},{name:"dec_TF"},{name:"$cwdec_TF"},{name:"str_TF"}],
            
                           showPrompt:false,criteriaPolicy:"dropOnChange",compareCriteria:function() { return 1; }});
            
             
            
            isc.VStack.create({
                ID:"table_AA",
                name:"table",
                height:"100%",
                width:"100%",
                members:[
                    isc.ListGrid.create({
                        fastCellUpdates:false,
                        groupStartOpen:"first",
                        dataSource:orderItemLocal2,
                        validateOnChange:true,
                        dataProperties:{
                            useClientFiltering:false,
                            neverDropUpdatedRows:true
                        },
                        ID:"GridFilterResultTable1",
                        showFilterEditor:true,
                        modalEditing:true,
                        canSelectText:true,
                        selectOnEdit:true,
                        willHandleErrors:true,
                        autoFetchData:true,
                        canSort:true,
                        headerButtonProperties:{wrap:true},
                        emptyMessage:"No items found.",
                        fields:[{title:"<nobr>Decimal - Radio Button - Horizontal&nbsp;<\/nobr>",
                            valueMap:{"22":"22","33":"33","99":"99"},
                            filterEditorType:"text",filterEditorValueMap:{},
                            filterEditorProperties:{required:false,validateOnChange:false},
                            name:"dec_RBH",align:"left",validateOnChange:true,width:"100"
                            },
                            {title:"<nobr>Decimal - Text Field&nbsp;<\/nobr>",
                            type:"decimal",displayField:"$cwdec_TF",
                            sortByDisplayField:false,
                            neverValidate:true,
                            validateOnChange:false,
                            filterEditorProperties:{_constructor:"TextItem",criteriaField:"dec_TF"},
                            name:"dec_TF",align:"left",width:"100"}
                            ,
                            {title:"<nobr>String - Text Field&nbsp;<\/nobr>",editorType:"text",
                            neverValidate:true,
                            validateOnChange:false,
                            filterEditorProperties:{_constructor:"TextItem",required:false,validateOnChange:false,type:"text",changed:function() { return true; }},
                            name:"str_TF",
                            align:"left",
                            width:"100"
                            }],
                    canEdit:false})
                ]});

            Comment

            Working...
            X