Adding a input field (select box) to a cell in a table that is rendered from controller

35 views
Skip to first unread message

Sumit Srivastava

unread,
Nov 29, 2012, 3:47:54 AM11/29/12
to rubyonra...@googlegroups.com
Hi,

I have a view in which a table is created with one head elements of the table are defined like,

%table.data-table{'data-searchable' => 'true'}
  %thead
    %tr
      %th Email
      %th.no-sort Name
      %th Registered
  %tbody


The table is populated through controller. I need to add a select box to every Email cell. How to add this?

Colin Law

unread,
Nov 29, 2012, 5:15:27 AM11/29/12
to rubyonra...@googlegroups.com
On 29 November 2012 08:47, Sumit Srivastava
The Rails Guide on Form Helpers shows you how to make select boxes.
Remember that for valid html the entire table must lie within the
form, or each cell must contain its own form.

Colin


>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonra...@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-ta...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/rubyonrails-talk/-/q2DqSWbPWH0J.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Jordon Bedwell

unread,
Nov 29, 2012, 5:18:52 AM11/29/12
to rubyonra...@googlegroups.com
On Thu, Nov 29, 2012 at 4:15 AM, Colin Law <cla...@googlemail.com> wrote:
> The Rails Guide on Form Helpers shows you how to make select boxes.
> Remember that for valid html the entire table must lie within the
> form, or each cell must contain its own form.

Aren't tables are violation of the HTML spec anyways? I thought it was
only div,section,span that could be inside of forms i could be wrong
about that but I could have swore reading that somewhere in the specs
for HTML.

sumit srivastava

unread,
Nov 29, 2012, 5:25:00 AM11/29/12
to rubyonra...@googlegroups.com
Actually Jquery dataTables is being used to fetch the data and create the table.

Regards
Sumit Srivastava

The power of imagination makes us infinite...


--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonra...@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-ta...@googlegroups.com.

Colin Law

unread,
Nov 29, 2012, 5:37:34 AM11/29/12
to rubyonra...@googlegroups.com
I think you are wrong there, I am sure table is valid inside a form.
I have just tried an example in the w3c html validator and it was
happy with it.

Colin

Colin Law

unread,
Nov 29, 2012, 5:39:49 AM11/29/12
to rubyonra...@googlegroups.com
On 29 November 2012 10:25, sumit srivastava
<sumit.the...@gmail.com> wrote:
> Actually Jquery dataTables is being used to fetch the data and create the
> table.

So the question is nothing to do with Rails then?

Colin

sumit srivastava

unread,
Nov 29, 2012, 5:55:59 AM11/29/12
to rubyonra...@googlegroups.com
I need to add a functionality to a code someone else wrote. Just found out that, the dataTables jquery is just being used to sort and paginate the table. But the table is actually populated through controller.


Regards
Sumit Srivastava

The power of imagination makes us infinite...


Colin Law

unread,
Nov 29, 2012, 5:59:38 AM11/29/12
to rubyonra...@googlegroups.com
On 29 November 2012 10:55, sumit srivastava
<sumit.the...@gmail.com> wrote:
> I need to add a functionality to a code someone else wrote. Just found out
> that, the dataTables jquery is just being used to sort and paginate the
> table. But the table is actually populated through controller.

So what do you not know how to do? You have read the guide I suggested I hope.

Please don't top post, it makes it difficult to follow the thread.
Post your replies inline in previous message. Thanks.

sumit srivastava

unread,
Nov 29, 2012, 6:04:39 AM11/29/12
to rubyonra...@googlegroups.com
On 29 November 2012 16:29, Colin Law <cla...@googlemail.com> wrote:
On 29 November 2012 10:55, sumit srivastava
<sumit.the...@gmail.com> wrote:
> I need to add a functionality to a code someone else wrote. Just found out
> that, the dataTables jquery is just being used to sort and paginate the
> table. But the table is actually populated through controller.

So what do you not know how to do?  You have read the guide I suggested I hope.

There is nothing in the view defined to add the form with select box. The data is coming from the controller directly as json. So how to add a select box from the controller to the table?

Colin Law

unread,
Nov 29, 2012, 6:34:41 AM11/29/12
to rubyonra...@googlegroups.com
On 29 November 2012 11:04, sumit srivastava
<sumit.the...@gmail.com> wrote:
>
> On 29 November 2012 16:29, Colin Law <cla...@googlemail.com> wrote:
>>
>> On 29 November 2012 10:55, sumit srivastava
>> <sumit.the...@gmail.com> wrote:
>> > I need to add a functionality to a code someone else wrote. Just found
>> > out
>> > that, the dataTables jquery is just being used to sort and paginate the
>> > table. But the table is actually populated through controller.
>>
>> So what do you not know how to do? You have read the guide I suggested I
>> hope.
>
>
> There is nothing in the view defined to add the form with select box. The
> data is coming from the controller directly as json. So how to add a select
> box from the controller to the table?

If you want a select box then you have to do that in the view.

Colin
Reply all
Reply to author
Forward
0 new messages