[ 2 posts ]

Schu

  • Username: acdara
  • Joined: Mon Sep 12, 2011 11:23 am
  • Posts: 19
  • Offline
  • Profile

Conditional editing/formatting by row on DataTable

Post Posted: Mon Sep 19, 2011 7:37 pm
+0-
I have a scenario where I want to set the editable, editor, formatter on a row by row basis for a given column

eg:
all rows satisfying condition1 will have editable textbox for column1
all rows satisfying condition2 will have editable dropdownbox for column1 with different format
all rows satisfying condition3 will have non editable column1 with a different format
(each row would only satisfy one condition)

How would I accomplish this?

I could figure out how to set format on a row by row basis by writing conditions based on row data in the formatter function
but I donot know how to make it not editable and how to apply different editors.

Satyam

YUI Contributor

  • Username: Satyam
  • Joined: Tue Dec 09, 2008 12:34 am
  • Posts: 2016
  • Location: Sitges, Spain
  • GitHub: Satyam
  • Gists: Satyam
  • IRC: DevaSatyam
  • YUI Developer
  • Offline
  • Profile
Tags:

Re: Conditional editing/formatting by row on DataTable

Post Posted: Mon Sep 19, 2011 9:16 pm
+0-
As for the formatters, you have this example:

http://www.satyam.com.ar/yui/#DataGrid

Regarding conditional editing, for normal editing, all cells editing, you do as described here:

http://developer.yahoo.com/yui/datatable/#cellediting

Now, you are not limited to bind the cellClickEvent to the onEventShowCellEditor helper method

myDataTable.subscribe("cellClickEvent", this.myDataTable.onEventShowCellEditor);

You can write your own listener for that event, read information from it such as which row or column was the one clicked, and then decide to call onEventShowCellEditor or not.
  [ 2 posts ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum