Welcome, Guest
Username: Password: Remember me

TOPIC: Version 2 - Manipulating data upon save

Re: Version 2 - Manipulating data upon save 07 Nov 2012 23:47 #5091

  • VeCrea
  • VeCrea's Avatar
  • Offline
  • Platinum Member
  • Absolute JCook fan
  • Posts: 473
  • Thank you received: 100
  • Karma: 30
admin wrote:
So I don't know.
It is in your hands. You will find.
Dump is your friend ;-)

Table > store() is the last call before the physical write in DB.

Well, if you don't know, how could I...
looks like $city is empty at the time it looks for the country name. But it's saved in db, if i edit this item again, then it finds the $city and can find back the $country.
The administrator has disabled public write access.

Re: Version 2 - Manipulating data upon save 07 Nov 2012 23:47 #5092

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
  • Karma: 64
Can't you filter by both...?

Do you mean a filter a grid or in a specific function?
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!
The administrator has disabled public write access.

Re: Version 2 - Manipulating data upon save 07 Nov 2012 23:48 #5093

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 984
  • Karma: 140
You will be able to filter directly by country very soon, once I've finished to implement better filters on different levels.

A detail
In the model, you can write in save(), but it is not the best.

The function in the MODEL is : prepareTable() Where the wizard are written.
This is why it has been confused with prepareQuery()
Now I understand ;-)... I am very tired...
Coding is now a piece of cake
Last Edit: 09 Nov 2012 16:24 by admin.
The administrator has disabled public write access.

Re: Version 2 - Manipulating data upon save 07 Nov 2012 23:49 #5094

  • VeCrea
  • VeCrea's Avatar
  • Offline
  • Platinum Member
  • Absolute JCook fan
  • Posts: 473
  • Thank you received: 100
  • Karma: 30
a grid.
No i can't filter on country as country is not saved
The administrator has disabled public write access.

Re: Version 2 - Manipulating data upon save 07 Nov 2012 23:52 #5095

  • VeCrea
  • VeCrea's Avatar
  • Offline
  • Platinum Member
  • Absolute JCook fan
  • Posts: 473
  • Thank you received: 100
  • Karma: 30
admin wrote:
You will be able to filter directly by country very soon, once I've finished to implement better filters on different levels.

A detail, I am very tired...
In the model, you can write in save(), but it is not the best.

The function in the MODEL is : prepareTable() Where the wizard are written.
This is why it has been confused with prepareQuery()
Now I understand ;-)

I use the "store" function in tables, not the prepareTable in model, which doens't even exist here, because i chose to put automatisms in Table
The administrator has disabled public write access.

Re: Version 2 - Manipulating data upon save 07 Nov 2012 23:55 #5096

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
  • Karma: 64
Just to check if I'm understanding correctly...

I have tables: countries & counties (states)
Countries have a name
Counties have a name and a country

I also then have a clients table with a county field... When new records are created here, I filter the counties on Countries using ajax checkbox in the options. Also, in the grid combo filter, I do the same... So, I first select a country then a county. Works perfectly...

Is this what you mean?

Gez
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!
The administrator has disabled public write access.

Re: Version 2 - Manipulating data upon save 07 Nov 2012 23:56 #5097

  • VeCrea
  • VeCrea's Avatar
  • Offline
  • Platinum Member
  • Absolute JCook fan
  • Posts: 473
  • Thank you received: 100
  • Karma: 30
It works, but it only saves the value of county. So i can't filter on country alone, i have to choose a county too, which is not what i want to do.
The administrator has disabled public write access.

Re: Version 2 - Manipulating data upon save 08 Nov 2012 00:01 #5098

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
  • Karma: 64
Ahhhh, right, I get it...

Isn't there an option to submit after each group in the ajax filters? Sure, I understand that this would still produce a city combo in your case but, that doesn't matter does it?

I mean, in the first select, results would be filtered by country???

Gez
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!
The administrator has disabled public write access.

Re: Version 2 - Manipulating data upon save 08 Nov 2012 00:02 #5099

  • VeCrea
  • VeCrea's Avatar
  • Offline
  • Platinum Member
  • Absolute JCook fan
  • Posts: 473
  • Thank you received: 100
  • Karma: 30
Last time i checked on this, it wasn't functional (three weeks ago if i remember ok)
The administrator has disabled public write access.

Re: Version 2 - Manipulating data upon save 08 Nov 2012 00:03 #5100

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
  • Karma: 64
I'm sure I had it working...

Hold on I'll check now
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!
The administrator has disabled public write access.

Re: Version 2 - Manipulating data upon save 08 Nov 2012 00:14 #5101

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
  • Karma: 64
You're right, it doesn't work...

Theoretically speaking, this should be as easy as making sure that the right joins are in place to travers back up to your country. Practically speaking, I'm not sure how to do this as I've not dug into the code for the ajax combo.

That said, I think that this is something that would be better changed at the core of the combo code as opposed to in any of your component's classes.
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!
The administrator has disabled public write access.

Re: Version 2 - Manipulating data upon save 08 Nov 2012 00:18 #5102

  • VeCrea
  • VeCrea's Avatar
  • Offline
  • Platinum Member
  • Absolute JCook fan
  • Posts: 473
  • Thank you received: 100
  • Karma: 30
Well, the thing is urgent so, even if it is not elegant, even if it's not the best solution, i would like to get back to my initial request : i want to be able to save the country in another field, but it doesn't work for some reason.
The administrator has disabled public write access.

Re: Version 2 - Manipulating data upon save 08 Nov 2012 00:24 #5103

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
  • Karma: 64
OK so,
When i CREATE the new item, it doesn't work. If i save the item, then i edit it, then i save it again, then it works and the country appears. Can't figure out why.

In the save function, shouldn't you target the city value with $data->city as opposed to $this?
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!
The administrator has disabled public write access.

Re: Version 2 - Manipulating data upon save 08 Nov 2012 00:34 #5104

  • VeCrea
  • VeCrea's Avatar
  • Offline
  • Platinum Member
  • Absolute JCook fan
  • Posts: 473
  • Thank you received: 100
  • Karma: 30
I use the store function in the tables folder.
using $data->city doesn't work
The administrator has disabled public write access.

Re: Version 2 - Manipulating data upon save 08 Nov 2012 00:45 #5105

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
  • Karma: 64
OK... Try this:

$maDB->setQuery ("SELECT c.id FROM #__xxx_countries as c WHERE c.id = $this->city");
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!
The administrator has disabled public write access.
Time to create page: 0.143 seconds

Get Started