I'm starting with ROR, coming from Delphi/Win32, I'm in the process of
learning, I know there are many tutorials and books for beginners, but
I didn't find any resources showing :
1. How to build an HTML page where the user can capture de master
table data, let's say Invoice Header (Customer, Date, etc) , and at
the same time add records for the detail table (Item ID, Quantity,
Price, etc) and finally save all in a single transaction (sumbit?),
also including product searching capabilities, is this posible ? May
be I'm taking a wrong approach.
2. The samples I've found are using screens where the user select
directly from a list (of products for example) to build a shopping
cart, but the products list I have to manage are from 30,000 products
and even more, so It would be nice to have a sample showing how to
link a complex search form which can return selected(s) product(s) to
the view who called it.
3. Please don't send me to google, I've been there and I did not find
any concrete example on this subject and I think I'm not the one
looking for something like this, so, it must exist something out there
treating this kind of subject, the wheel was already invented I think.
If someone can help me with some tutorial/samples I will really
appreciate that. I'm not looking for someone who make my job, but
coming from a drag & drop world is hard to imagine some things, when I
met ROR I can say that almost felt in love, but now I'm trying to do
something more complex than a simple scaffold and I really having a
hard time with this, but I think I can make an extra effort before
watching in another direction.
This is not a complete answer, but I can give you some pointers how to
handle this.
(Real RoR-Experts: please complete and correct me).
- this sounds like a case for Ajax functionalities - check out rjs on
how to change the form without reloading and how to use live-searches
to complete the product data
- use partials to display the sub-forms
- in theses partials use <%= fields_for ... do %> to handle subforms
cleanly within the same form
- use the empty-bracket -notation to automatically insert the id of
the subform's model in to the field-name.
> > > I'm starting with ROR, coming from Delphi/Win32, I'm in the process of
> > > learning, I know there are many tutorials and books for beginners, but
> > > I didn't find any resources showing :
>
> > > 1. How to build an HTML page where the user can capture de master
> > > table data, let's say Invoice Header (Customer, Date, etc) , and at
> > > the same time add records for the detail table (Item ID, Quantity,
> > > Price, etc) and finally save all in a single transaction (sumbit?),
> > > also including product searching capabilities, is this posible ? May
> > > be I'm taking a wrong approach.
when I've had to implement a master/detail view in a rails project,
I've used a partial for the master list which I can paginate and
filter using ajax, and a partial for the detail view which can be
updated/saved/edited using ajax as well. I use the will_paginate
plugin for the pagination (with a little bit of added code to take
care of the ajax part - if you search through the tickets on the
will_paginate issue tracker at err.lighthouseapp.com you'll find some
patches for adding ajax functionality to the plugin)
The form is just a case of using form_remote_tag (or form_remote_for)
and then possibly re-rendering the master list.
> > > 2. The samples I've found are using screens where the user select
> > > directly from a list (of products for example) to build a shopping
> > > cart, but the products list I have to manage are from 30,000 products
> > > and even more, so It would be nice to have a sample showing how to
> > > link a complex search form which can return selected(s) product(s) to
> > > the view who called it.
not sure what you're trying to do here. Are you trying to display a
form which allows you to filter/search through your massive product
list, and then add a single item to a cart? This type of thing
doesn't need ajax, although you can use it if you want.
I'm just wan to say thank you all, I'm investigating with your
advices.
Regards,
Mocte
Hi all,
I am also looking for some advices on how to make a master-details form
which allow the user to update the data of both the master table and the
detail table. I found one solution demonstrated by Unsapce..here is the
link:
It make use of the "onblur" event to invoke an javascript, the
javascript then submit an Ajax.Request to run an "action". One technique
it used is to embed the IDs of the detail rows in an hidden field
rendered on the screen.
I used the same approach which really works, the only draw back is that
it need quite a lot of coding to complete the whole form. I just want to
ask if some one has other solution for master-detail-form applcation.