How to hide the NULL values in list item get from store in sencha touch

1.5k Views Asked by At

enter image description hereI have implemented an application in sencha touch.

in that i have a list view , i retrieve the data from the store,

in data base in some fields i have inserted null values,{No selection}.

the corresponding fields in list view are displayed as NULL,

But i want to display an empty space instead of NULL,

        {
                  xtype: 'list',

                  itemTpl: [
                            '<div id="wrapper">'+
                            '<div class="frt">{Name}</div>'+
                            '<div class="frt">{Title}</div>'+
                            '<div class="frt">{Contact}</div>'+
                            '<div class="frt">{Zip}</div>'+
                            '</div>'
                            ],
                  store: 'ContactsDataBase'
             }
2

There are 2 best solutions below

1
On BEST ANSWER
{
       xtype: 'list',
       itemTpl: [
                   '<div id="wrapper">'+
                   '<div class="frt"><tpl if="Name != null">{Name}</tpl></div>'+
                   '<div class="frt"><tpl if="Title != null">{Title}</tpl></div>'+
                   '<div class="frt">{Contact}</div>'+
                   '<div class="frt">{Zip}</div>'+
                   '</div>'
                ],
        store: 'ContactsDataBase'
}

Visit Sencha Touch docu site for more information.

Cheers, Oleg

0
On

A slight modified version

itemTpl: [
               '<div id="wrapper">'+
               '<div class="frt"><tpl if="values.Name">{Name}</tpl></div>'+
               '<div class="frt"><tpl if="values.Title">{Title}</tpl></div>'+
               '<div class="frt">{Contact}</div>'+
               '<div class="frt">{Zip}</div>'+
               '</div>'
            ]