Using InputField inside MapThread
- To: mathgroup at smc.vnet.net
- Subject: [mg126102] Using InputField inside MapThread
- From: Robert Wright <mathematicauser1 at yahoo.com>
- Date: Tue, 17 Apr 2012 06:04:53 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- Reply-to: Robert Wright <mathematicauser1 at yahoo.com>
Can someone see why the first block of code works and the second does not. And how do I fix the problem, the idea is be able to 'filter' the container 'data' so that each OpenerView displays the data corresponding to the filter. data = { {"1", "Category1", "Subcat11", Null}, {"2", "Category1", "Subcat12", Null}, {"3", "Category1", "Subcat13", Null}, {"4", "Category2", "Subcat21", Null}, {"5", "Category2", "Subcat22", Null}, {"6", "Category2", "Subcat23", Null}}; fieldWidths = {5, 15, 20, 20}; nColumns = 4; DB = Cases[data, {_, "Category2", _, _}]; (*this example works*) OpenerView[{"Category2", Dynamic@Style[ TableForm[ Partition[ MapThread[ InputField[Dynamic[DB[[#1, #2]]], String, FieldSize -> #3] &, Append[ Transpose@ Flatten[Table[{i, j}, {i, Length@DB}, {j, 1, nColumns}], 1], Flatten@Table[ fieldWidths, {Length@DB}]]], nColumns]], FontFamily -> "Arial", FontSize -> 10] }] (*this example doesn't *) OpenerView[{"Category2", Dynamic@Style[ TableForm[ Partition[ MapThread[ InputField[ Dynamic[Cases[data, {_, "Category2", _, _}][[#1, #2]]], String, FieldSize -> #3] &, Append[ Transpose@ Flatten[Table[{i, j}, {i, Length@Cases[data, {_, "Category2", _, _}]}, {j, 1, nColumns}], 1], Flatten@Table[ fieldWidths, {Length@ Cases[data, {_, "Category2", _, _}]}]]], nColumns]], FontFamily -> "Arial", FontSize -> 10] Thanks, Robert