PDA

View Full Version : Live Search


captainm1uk
09-20-2007, 07:03 AM
Hi I have been trying to do a live search to the Domino Directory with no such luck.
I type in a name - it flashes up searching then flashes up. Can anyone help - here is the code

Ext.onReady(function(){
NAB_Proxy_Url="/names.nsf/($VIMPeopleByLastName)?readviewentries&Count=10&StartKey=";
var NAB_Proxy = new Ext.data.HttpProxy({
url: NAB_Proxy_Url
});
var NAB_Store = new Ext.data.Store({
proxy: NAB_Proxy,
reader: new Ext.data.JsonReader(
{
record: "viewentry",
id: 'address'
},
[
// {name: "address", mapping: "entrydata[@columnnumber=1] > test"},
{name: "first", mapping: "entrydata[@columnnumber=3] >text"},
{name: "middle", mapping: "entrydata[@columnnumber=4] >text"},
{name: "last", mapping: "entrydata[@columnnumber=1] >text"},
]
)
});
// Custom rendering Template
// var resultTpl = new Ext.Template(
// '<div class="search-item">',
// '<h3><span>{lastPost:date("M j, Y")}<br />by {author}</span>{title}</h3>',
// '{excerpt}',
// '</div>'
// );

var combo_names = new Ext.form.ComboBox({
allQuery: "",
displayField:'address',
typeAhead: false,
emptyText: 'Select an address...',
loadingText: 'Searching...',
width: 570,
selectOnFocus: true,
store: NAB_Store,
triggerAction: "all",
typeAhead: true,
//tpl: resultTpl,
onSelect: function(record){ // override default onSelect to do redirect
window.location =
String.format('http://extjs.com/forum/showthread.php?t={0}&p={1}', record.data.topicId, record.id);
}
});

combo_names.on("beforequery", function (e) {
NAB_Proxy.conn.url = NAB_Proxy_Url + e.query;
});
// apply it to the exsting input element
combo_names.applyTo ('search');
});