zhoupan / jmesa

Automatically exported from code.google.com/p/jmesa
0 stars 0 forks source link

Dynamic drop down values for a column based on the selection of value from the different column #311

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Jeff,

I do not know where to post this so I am posting it here. I have a requirement 
of having a dynamic table which has the columns with dynamic drop downs.

For example: For a given row, lets say we have 2 columns - column A and column 
B and both are drop downs and the user makes the selection from the drop downs.

The column B drop down changes dynamically based on the selection of  column A. 
 I do not know how to implement this in Jmesa. I would really appreciate if you 
could suggest me how to implement this scenario. Is it possible in Jemsa ?

I am using 3.0.3 version of Jmesa.

Thanks,

Original issue reported on code.google.com by cmank...@gmail.com on 1 Apr 2011 at 8:36

GoogleCodeExporter commented 9 years ago
I can send you more information tomorrow, but the short of it is that you need 
to create two custom FilterEditors. 

This should work yet...take a look at the DroplistFilterEditor source if you 
need to.

http://code.google.com/p/jmesa/wiki/CustomDroplistFilterEditorTutorial

To get the filter value you can call getCoreContext().getLimit().getFilter();

Original comment by jeff.johnston.mn@gmail.com on 4 Apr 2011 at 12:38

GoogleCodeExporter commented 9 years ago
Thanks!! Jeff for the quick response. From what I understand, filter dropdown 
is the one which appears on the top of the column... just like 'career' filter 
in the worksheet example. But what actually need is a droplistworksheet editor 
which refreshes the column B cell droplist based on the selection of the Column 
A droplistworksheet cell.

Example: Column A worksheet cell has dropdownvalues (can be populated by 
setting the  droplistworksheeteditor on the htmlcolumn ) - 'Code A', 'Code B', 
'Code C'. If the user selects - 'Code A' then the column B should populate Code 
A related values - in this case it will be 10,20,30 (it should fetch these 
values from the database dynamically). If user selects Code B then the Column B 
should be refreshed with the values - 40,50,60 for the Code C - the values 
should be 70,80,90,100.

I really appreciate if you could let me know if it can be implemented in Jmesa. 
If not, is there any workaround for doing this. Thanks!!!

Original comment by cmank...@gmail.com on 4 Apr 2011 at 1:50

GoogleCodeExporter commented 9 years ago
If the first filter dropdown does a page refresh (the default behavior) then 
you can limit the data of the second filter based on the filter value of the 
first. That is why you would have to get the Limit information to find out how 
the first dropdown was filtered.

If you do not do a page refresh for the first dropdown then you could use a 
custom filter editor with some JavaScript. You would have to conform to the 
JMesa parameter naming convention but it would work.

Original comment by jeff.johnston.mn@gmail.com on 4 Apr 2011 at 3:57

GoogleCodeExporter commented 9 years ago
The JavaScript way would be more work because you would have to understand more 
about how JMesa works...

Original comment by jeff.johnston.mn@gmail.com on 4 Apr 2011 at 3:58

GoogleCodeExporter commented 9 years ago
Jeff,

Will I be using droplistfilterdropdown or droplistworksheeteditor to achieve 
this??? I am bit confused here. In my scenario - 

Add new row(Row1) in the worksheet by clicking the - 'Add  Row' icon
For Row 1 -  I can select option 'Code A' from column A and the column B (row 
1) gets refreshed with the appropriate values. (10,20,30)

Add second row(Row2) in the worksheet by clicking the - 'Add  Row' icon.
For Row 2 - I can select option 'Code B' from Column A and the column B (row 2) 
gets refreshed with the appropriate values.(40,50,60)

Thanks!! Jeff.

Original comment by cmank...@gmail.com on 6 Apr 2011 at 2:28

GoogleCodeExporter commented 9 years ago
Sorry, I did not realize that you were trying to do this with the worksheet.

I actually have code that does what you need using a jQuery autocomplete 
plugin. I had the same requirement recently. The integration points are even 
built into JMesa 3.0.4.

I know you are asking about using the droplist and not autocomplete, but it can 
be a better user experience. How about if I write up a wiki page that explains 
it...I need to write something about it anyway. I can do that this week (maybe 
even over lunch today depending on how long it takes)! Then you can adapt it to 
the droplist if you need to.

Original comment by jeff.johnston.mn@gmail.com on 6 Apr 2011 at 3:24

GoogleCodeExporter commented 9 years ago
Thanks!! Jeff for the quick response. This is what I was looking for a while 
now. In the mean time if you have any example code that does this, please let 
me know. I will take a look at it and try to implement it in my application. 
Thanks!!

Original comment by cmank...@gmail.com on 6 Apr 2011 at 4:38

GoogleCodeExporter commented 9 years ago
Here you go!

Be sure to upgrade to JMesa 3.0.4.

http://code.google.com/p/jmesa/wiki/AutoCompleteWorksheetEditor

Original comment by jeff.johnston.mn@gmail.com on 6 Apr 2011 at 9:55

GoogleCodeExporter commented 9 years ago
Thanks! Jeff.

Original comment by cmank...@gmail.com on 7 Apr 2011 at 1:10