Support Forum Softcomplex logo
About Us  | Services  | Download  | Order  | Support  | |
| Search | Today's Posts | Stats | Board Rules | Not logged in [ Login | Register ]
go to bottom
Last active: Never

Printable Version | Subscribe | Add to Favourites   Post new thread
Author: Subject: searching caption with regular expressions in the api openItemByCaption
kikcontains
Junior Member

Posts: 6
Registered: 9/6/2006
Member Is Offline
posted on 9/6/2006 at 01:33 AM Reply With Quote
searching caption with regular expressions in the api openItemByCaption


i downloaded the api openItemByCaption from the examples API page.

It's works fine, but this function only returns ok when it founds a exact match. It's possible found it using a regular expression like "01-01*" or "*eating*"?

Thanks
View User's Profile View All Posts By User U2U Member
tigra
Administrator

Posts: 2049
Registered: 6/17/2002
Location: US, CO
Member Is Offline
posted on 9/6/2006 at 11:32 AM Reply With Quote

the embedded function does exact match only, but you can define own search function externally. Here is the sample:

[code]
function setTree (s_caption) {
var o_tree = trees[0],
o_item;
for (var i = 0; i < o_tree.a_index.length; i++)
if (o_tree.a_index[i].a_config[0] == s_caption) { // that's where you make the change
o_item = o_tree.a_index[i];
break;
}
if (!o_item)
return alert('item ' + s_caption + ' not found');

// following code opens the parents and selects found item
var n_id = o_item.n_id,
n_depth = o_item.n_depth,
a_index = o_item.o_root.a_index,
a_parents = [o_item];

while (n_depth) {
if (a_index[n_id].n_depth < n_depth) {
a_parents[a_parents.length] = a_index[n_id];
n_depth--;
}
n_id--;
}

for (var i = a_parents.length - 1; i >= 0; i--)
// check if node or root
if (a_parents[i].a_children) {
a_parents[i].open();
}
o_item.select();
}
[/code]
View User's Profile View All Posts By User U2U Member
Post new thread

Related Links:
Product Page
Product Demonstrations Live Demos
Multiple Trees
Frames Targeting
Icons and Styles Overloading
Event Handling
Performance Test
Version 1.2 features
Product Documentation Documentation
Documenation Page
Change Log
Support Forum Technical Support
Support Forum
Customer Care System
Order Now ORDER NOW!
Add to Cart
View Cart
 

Go To Top


Powered by XMB 1.9.1 Nexus
Developed By Aventure Media & The XMB Group © 2002-2004