In Add/Edit pages update Lookup Table Select2 control at runtime

This public forum is for user-to-user discussions of ASP.NET Maker. Note that this is not support forum.
Post Reply
Andros
User
Posts: 111

In Add/Edit pages update Lookup Table Select2 control at runtime

Post by Andros »

Hi. I have two tables (it is an example, my needing is more complex):
reports - ReportID, Country, CustomerID...
customers - CustomerID,Name,Country, ...
In reports the CustomerID is setup with customers lookup table as usual.

When I ADD/EDIT a new report I want to select the Country, and then filter the customers lookup table by that country.
But I don't want to use dynamic selection, because, for example, I want to show the customer of that country and also the customers which don't have any country setup.

Is there any simple way to do this via javascript client code? The lookup_selecting filter is ok but it runs before outputting the page, while I need to customize the lookup table at runtime.

I can use the the client side events to intercept a field modification, and then what code can I use to rebuild the reports.CustomerID select2 list calling internal apis?


crash
User
Posts: 151

Post by crash »

Use the filter lookup table settings.. there is an example when you set it up


Andros
User
Posts: 111

Post by Andros »

but the "lookup table" filter is evaluated server-side at the page rendering time, and not every time the control is opened by the client, isn't it?


MichaelG
User
Posts: 1110

Post by MichaelG »


Andros
User
Posts: 111

Post by Andros »

Ok thank you. What about filling


Andros
User
Posts: 111

Post by Andros »

Ok thank you.
In the example we can fill an INPUT control as written: $("#x_UnitPrice").val(row["UnitPrice"]);
What about filling select2 control?


MichaelG
User
Posts: 1110

Post by MichaelG »

It should be similar. Just trigger the change event after update.


Post Reply