Hmm, I'm not sure updateAll will work in this case. It will work fine
if you want to update all rows with the same data but not otherwise.
If you want it to behave more like excel, where you can edit all
fields of all rows (or at least paginated rows) here's what I'd do:

1) Select all rows in your controller
2) In your view, inside a foreach($results as $result) loop generate a
new ajax form for each row in your results. with input fields for each
field in that particular row.
3) here, you can do a couple things: 1) generate a separate ajax
button for each form that submits to an update function that saves
that particular row and refreshes the row's div. OR 2) to make it more
like excel, make the ajax button hidden (ie display none) and put in a
javascript function that submits the ajax button during the onChange
of each field in the row. sort of an "Autosave" feature.

OR

you could generate inputs for each field incremently named (ie
name="Model.1.someField", name="Model.1.anotherField" .... name
="Model.2.someField", name="Model.2.anotherField" etc) and submit all
data with the same button and then in your controller go through your
data with a foreach loop and save each one ( foreach($this-
>data["Model"] as $model){$this->Model->save($model)} )


On Apr 29, 10:53 am, grigri <[EMAIL PROTECTED]> wrote:
> $this->YourModel->updateAll(array('new_field' => 'new_value'),
> array('1=1'));
>
> Note that you'll have to quote/escape the value yourself.
>
> On Apr 29, 4:27 pm, SumanRS <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > I've been using CakePHP for creating an online version of a listing
> > that has long been maintained using Excel. There are several hundred
> > rows in this table.
>
> > However, one thing where the Excel UI wins is in allowing a new field
> > (column) to be added. After that, it is easy to update the field for
> > all rows. If I wanted to do this in Cake, I would have to click "Edit"
> > on each row and edit the value for the field for each row.
>
> > One way I can think of solving this is:
> > 1. Export the CakePHP values to a CSV
> > 2. Edit the CSV in Excel
> > 3. Write PHP to open the edited CSV and update the fields (I've done
> > this before)
>
> > Is there a way to do this natively (and easily) in CakePHP?
>
> > Thanks,
> > SumanRS
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to