Considering some data:

data = {{DateObject[{2015, 7, 9}], "81st", 10.5187}, 
  {DateObject[{2015, 7, 10}], "81st", 11.0627}, 
  {DateObject[{2015, 7, 13}], "81st", 10.6428}, 
  {DateObject[{2015, 7, 13}], "71st", 21.5}};

It's not hard to use Grid to present the data in tabular format where it is easily digested.

  Grid[(data /. x_ /; DateObjectQ[x] :> 
   DateString[x, {"MonthShort", "/", "DayShort", "/", "Year"}]), 
Frame -> All], 18, FontFamily -> "Calibri"], 
 ImageSize -> {Automatic, 100}, Scrollbars -> {False, True}]

enter image description here

Coupling with Dynamic it would be nice to be able to select certain rows of data for later use, either deletion or amending or whatever. Conveniently, we have ListPicker:

 Thread[Range[Length[data]] -> Map[Row[#, " - "] &, data]]]

enter image description here

What I'd like to be able to do is have the data in each element (ie row) of ListPicker to be aligned as it would be in the above Grid example.

Any way to accomplish this?


As I was typing the question, I thought of a way by adding a level to data. As the question was already typed, I just decided to answer my own question, hoping that someone else has an easier way. This method also restricts all column widths to be the same.

 Thread[Range[Length[data]] -> 
 Map[Grid[{#}, Frame -> All, ItemSize -> 15] &, data]]]

enter image description here

| improve this answer | |
  • $\begingroup$ @Kuba Good catch. I originally had it as the Map[] form, but changed it to infix when I was cleaning it up to post here. I switched it back and it works as I originally intended. $\endgroup$ – kale Jul 15 '15 at 12:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.