Yii Framework Forum: Master, Detail, Ajax And Script - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

Master, Detail, Ajax And Script Rate Topic: -----

#1 User is offline   PoL 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 506
  • Joined: 05-November 08
  • Location:Buenos Aires, Argentina

Posted 28 April 2009 - 09:17 AM

Hello again.
Today I have a "large to explain" problem:


I have two models, Master,and Details, each Invoide can have many details:





I have a form like the following:


As yo can see, I make an ajax call to master/addDetail, here is the code:




Now, the view /detail/_table is the following:




This works perfect, I mean, I fill the "Detail section" of the form and when I click on "Add detail" a new Table, is appended to the listDetails div.
That table has the names of the field, id, and values filled correclty too.

But, the script that should work (e.g. The datepicker, or the script for the remove button) doesn't work.
I like if these scripts never exists.

I hope that this be clear, and that anybody can help me with that...



0

#2 User is offline   yoshi 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 170
  • Joined: 28-February 09
  • Location:Germany

Posted 28 April 2009 - 03:11 PM

Hi,

well, in my opinion it's true - they really don't exist...

Because you're making an ajax call and the renderPartial sends the contents of /detail/_table back, but you're not reloding the page, so how should yii be able to insert the JS code inside the document.ready function?
This would mean that yii has to extend the document.ready function dynamically (also with javascript) or you think, that you can have two of these functions, just because you are using a view?! This doesn't work.

For the delete button it's quite simple to solve, you can add the function directly to the button, there is no need to put it inside the ready-function. To be absolutly sure that the page is completly loaded at this point you may enable the 'Add details'-button via js inside the ready function.

With the DatePicker i think it's a bit tricky if you want to use the extension instead of creating your "own" one directly using jQuery.

Greets
0

#3 User is offline   bilge 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 07-December 09

Posted 07 December 2009 - 06:52 AM

View PostPoL, on 28 April 2009 - 09:17 AM, said:

...

I have two models, Master,and Details, each Invoide can have many details:

<!--NoParse334-->



I have a form like the following:
<!--NoParse335-->

As yo can see, I make an ajax call to master/addDetail, here is the code:
<!--NoParse336-->



Now, the view /detail/_table is the following:


<!--NoParse337-->

...



Hi,

In the above post of yours, your code samples cannot be seen. I want to make a detail entry form and want to make something similar to yours. Would you mind posting the code samples for your form, the ajax call to master/addDetail and the view /detail/_table.

Many thanks,
Bilge
0

#4 User is offline   amdawi 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 37
  • Joined: 01-August 10

Posted 18 December 2010 - 05:37 AM

View Postbilge, on 07 December 2009 - 06:52 AM, said:

Hi,

In the above post of yours, your code samples cannot be seen. I want to make a detail entry form and want to make something similar to yours. Would you mind posting the code samples for your form, the ajax call to master/addDetail and the view /detail/_table.

Many thanks,
Bilge

Really I want ti understand Master-Detail with Yii , But until now I could not found documentation about it.
Please help us ..

Thanks,
0

#5 User is offline   PoL 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 506
  • Joined: 05-November 08
  • Location:Buenos Aires, Argentina

Posted 21 December 2010 - 07:57 AM

The code dissapears because, when the site was very young, another forum engine was used (PhpBB if I'm not wrong).
Later the forum was upgraded to IP.Board and in the import of the old forum conversations some thiws were lost (code, some links, images, etc).

But, to answer your question, I haven't that code right now, but I can give you something:

http://www.yiiframew...le-with-jquery/

What I try to do is something like that, you can see there for some inspiration!!!
Don't say what you think, think what you say
The problem is communication! Excess of communication!
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users