PDA

View Full Version : Sencha Touch UI Search with Solr and MongoDB



locutusUT
27 Nov 2012, 1:36 PM
Check out how to extend MongoDB with Solr search and expose it through a Sencha Touch UI.

http://wp.me/xvmV

mitchellsimoens
29 Nov 2012, 10:01 AM
Nice article!

Just some feedback that jumps out at me right away. You are really overnesting with this code:


Ext.define('MyApp.view.PetPanel', {
extend: 'Ext.Panel',
alias: 'widget.petListPanel',
config: {
layout: {
type: 'fit'
},
items: [
{
xtype: 'toolbar',
docked: 'top',
title: 'Dog Tags'
},
{
xtype: 'searchfield',
docked: 'top',
name: 'query',
id: 'SearchQuery'
},
{
xtype: 'list',
store: 'PetTracker',
id: 'PetList',
itemId: 'petList',
emptyText: "<div>No Dogs Found</div>",
loadingText: "Loading Pets",
itemTpl: [
'<div>{name} is a {description} and is located at {latitude} (latitude) and {longitude} (longitude)</div>'
]
}
],
listeners: [
{
fn: 'onPetsListItemTap',
event: 'itemtap',
delegate: '#PetList'
},
{
fn: 'onSearch',
event: 'change',
delegate: '#SearchQuery'
},
{
fn: 'onReset',
event: 'clearicontap',
delegate: '#SearchQuery'
}
]
},
onPetsListItemTap: function (dataview, index, target, record, e, options) {
this.fireEvent('petSelectCommand', this, record);
},
onSearch: function (dataview, newValue, oldValue, eOpts) {
this.fireEvent('petSearch', this, newValue, oldValue, eOpts);
},
onReset: function() {
this.fireEvent('reset', this);
}
});

What I mean is the list can have docked items so it doesn't need to be within a panel like that.