DroplistWorksheetEditor and AutoCompleteWorksheetEditor

36 views
Skip to first unread message

Sam Welter

unread,
Apr 27, 2012, 4:02:41 PM4/27/12
to jmesa_forum
Hi there - I'm working on implementing worksheets for multiple tables.
I really like the functionality for AutoCompleteWorksheetEditor (as
described here - http://code.google.com/p/jmesa/wiki/AutoCompleteWorksheetEditor),
especially the example that shows how to restrict the returned values
for a field based upon the value in the previous column. I have many
data structures that follow this pattern of a child list dependent
upon a parent list.

Some issues:
1) In the listing above, the SingleValueWorksheetEditor extends
WorksheetEditor. I assume that ithis should be corrected to
SingleValueWorksheetEditor, yes?

2) I actually don't want the displayed name of the autocomplete, but
its ID. For example, one of the data dependencies I have for two
linked fields is country:state/province. I want the user to search and
see the country by name, and have the state/province autocomplete be
populated by country, but I want to lookup the state(s) in that
country by its three letter country code, and persist those codes to
the database. Similarly, I don't want to save "StateName", I want to
save "SN."

Before I discovered that Jmesa's autocomplete possessed the dependent/
linked data functionality, I was exploring how to achieve this by
chaining selects using DroplistWorksheetEditor. Now that I've found
AutoCompleteWorksheetEditor, which seems more elegant, I think it
should use it instead, but I'd like to add the ability to retrieve
name/value pairs, rather than a single value. Any tips/advice for
making this work?

3) In general, it seems like there is a lot of cool stuff on the Jmesa
site and in the discussion groups, but can be hard to find, and
sometimes it is difficult to tell which is the latest version of some
code/patches/enhancements. For example, I found a version of
DroplistWorksheetEditor in the discussion groups that seems to work
better than the one that was bundled in the jar. Is this a "known
issue"? Is there anything we as a community can do to help alleviate
this?

Thanks!
Message has been deleted

Sam Welter

unread,
Apr 27, 2012, 4:26:51 PM4/27/12
to jmesa_forum
I'm really struggling this afternoon!

Regarding (1), what I'm trying to ask is...
//this -
public class SingleValueWorksheetEditor extends WorksheetEditor {

//should be this -
public class SingleValueWorksheetEditor extends
AutoCompleteWorksheetEditor {

Right?

On Apr 27, 3:02 pm, Sam Welter <samuel.r.wel...@gmail.com> wrote:
> Hi there - I'm working on implementing worksheets for multiple tables.
> I really like the functionality for AutoCompleteWorksheetEditor (as
> described here -http://code.google.com/p/jmesa/wiki/AutoCompleteWorksheetEditor),

Sam Welter

unread,
May 1, 2012, 7:26:53 PM5/1/12
to jmesa_forum
Actually, it looks like this line:

htmlColumn.setWorksheetEditor(new AutoCompleteWorksheetEditor("/
autocomplete/singlevalue.do"));

doesn't work either; AutoCompleteWorksheetEditor is declared as
abstract. So I must extend it and create SingleValueWorksheetEditor,
yes?

Also, until the new version of JMesa is released, do you recommend
downloading and using bassistance library's autocomplete in the
interim?

Please let me know. Also, please let me know if you have any
suggestions regarding the questions above.

Thank you so much!

Sam
> > Thanks!- Hide quoted text -
>
> - Show quoted text -

Jeff Johnston

unread,
May 2, 2012, 4:51:04 PM5/2/12
to jmesa...@googlegroups.com
The easiest thing to do would be to look at the source for the AutoCompleteWorksheetEditor/AbstractWorksheetEditor and the jquery.jmesa.js file. Between those two you should have everything you need to get what you need. And if you really want to customize things you could put in a custom view to swap out the client side validation code (in the HtmlSnippets).

So for something like this you really do need to do some digging to figure out what you need, but there is no substitute for just looking at the source...and I tried to make the view extension points very easy to look at and modify. And with JMesa you can easily swap out everything about the view as it is completely separated.

What I would do if I were you is take the AutoCompleteWorksheetEditor from the source and put it in your project. Then see how it interacts with the javascript. From there you should be able to tweak it however you need. If you need to swap out other things about the view then do the same with HtmlView.

As a rule of thumb you can pretty much count on there being an abstract class as an extension point for your project.

One of the only things I would like to figure out how to improve is right now if you want to tweak the javascript you have to modify the core jquery.jmesa.js, which means if I change it then you need to merge when a new release comes out.

Then as for your question about the community and examples...if you have better examples or want to add to the documentation I would add it to the wiki!

Hope that helps...I know I did not answer you question directily but once you really get into it I think you will be able to figure out what you need.

-Jeff Johnston

Sam Welter

unread,
May 3, 2012, 2:38:13 PM5/3/12
to jmesa_forum
Thanks, I'll do my best.

One question I do hope you will answer, though - I can't seem to
figure out which AutoComplete to use right now, and I keep getting JS
errors in firebug (eg, "data.split is not a function - line 388") Some
searching states that passing the option dataType: "json" fixes that
issue, but it hasn't for me.

Currently, I'm using the bassistance extension. Is that incorrect?
Should I be using the autocomplete that is integrated into the latest
version of jquery?

Sam
> > > - Show quoted text -- Hide quoted text -

Jeff Johnston

unread,
May 3, 2012, 4:46:01 PM5/3/12
to jmesa...@googlegroups.com
I have been using the bassistance plugin as well. Ideally we should get over to the one integrated with jquery.

But remember if you are motivated you can define a view that uses whatever you want.

-Jeff
Reply all
Reply to author
Forward
0 new messages