salk31 / RedQueryBuilder

SQL Query Builder UI JavaScript component
http://redquerybuilder.appspot.com/
Eclipse Public License 1.0
95 stars 22 forks source link

onTableChange is only fired when table[0] is changed, not on FK selection #43

Open jestrickler opened 9 years ago

jestrickler commented 9 years ago
  1. Select table1 from the table select. The callback shows table1 in filters[0]
  2. Add a condition and select a foreign key. onTableChange is not called
  3. Select table2 from the table select. The callback shows table2 and the FK_table from step2 in filters[0] & [1]

notes:

salk31 commented 9 years ago

Would it be really annoying to use SQL change event? ie cause too much work to be done by the client?

I'm not sure if this is a feature or a bug but wondering about what would work best for you while that sorts itself out.

jestrickler commented 9 years ago

I was thinking of SQL change or adding a listener on column select, but I'm not sure how to get at the tables other than brute force comparing selected columns to metadata to see if an FK was selected.

salk31 commented 9 years ago

I think the new visitor stuff should be good for this. Just visit all the tables? I'll have a look/patch to add support for that if that sounds helpful to you?

jestrickler commented 9 years ago

That does sound like it could be good

salk31 commented 9 years ago

Do you have any preference if the visitor visits each table filter in turn or visits a single "from" node and provides a sensible data structure? I think I'm most tempted by the former as it matches visiting lots of nodes in the where clause.

jestrickler commented 9 years ago

Whichever you think works best. Thanks.

salk31 commented 9 years ago

http://savage.net.au/SQL/sql-92.bnf.html I think I will use for the node names/types for visiting.