RedQueryBuilder icon indicating copy to clipboard operation
RedQueryBuilder copied to clipboard

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

Open jestrickler opened this issue 10 years ago • 7 comments

  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:

  • If I save after step2 and reload, onTableChange will show both table1 and the FK_table
  • You can also see that the table change growl notification is not fired on FK selection at http://redquerybuilder.appspot.com/
  • I'm on Chrome Version 45.0.2454.93 (64-bit), on Mac 10.10.1
  • I am interested in doing something similar to: http://stackoverflow.com/questions/21914192/select-clause-editing-in-redquerybuilder

jestrickler avatar Sep 18 '15 18:09 jestrickler

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.

salk31 avatar Sep 21 '15 07:09 salk31

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.

jestrickler avatar Sep 21 '15 12:09 jestrickler

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?

salk31 avatar Sep 21 '15 12:09 salk31

That does sound like it could be good

jestrickler avatar Sep 21 '15 12:09 jestrickler

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.

salk31 avatar Sep 23 '15 08:09 salk31

Whichever you think works best. Thanks.

jestrickler avatar Sep 23 '15 15:09 jestrickler

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

salk31 avatar Oct 27 '15 10:10 salk31