Re: [web2py] Using Ajax Callback() in a delete functions

2020-01-24 Thread mostwanted
Thanks Ramos

On Friday, January 24, 2020 at 7:01:47 PM UTC+2, Ramos wrote:
>
> Have you read this ???
>
>
> A
>
> This helper is used to build links.
>
> >>> print A('', XML('me'),
> >>> _href='http://www.web2py.com') >>> href='http://www.web2py.com'>clickme
>
> Instead of _href you can pass the URL using the callback argument. For 
> example in a view:
>
> {{=A('click me', callback=URL('myaction'))}}
>
> and the effect of pressing the link will be an ajax call to "myaction" 
> instead of a redirection. In this case, optionally you can specify two more 
> arguments: target and delete:
>
> {{=A('click me', callback=URL('myaction'), target='t')}}
>
> and the response of the ajax callback will replace the content (inner 
> HTML) of the DIV with id equal to "t".
>
> {{=A('click me', callback=URL('myaction'), delete='div#b')}}
>
> and upon response, the closest tag matching "div#b" will be deleted. In 
> this case, the whole DIV with the link will be deleted.
>
> A typical application is:
>
> {{=A('click me', callback=URL('myaction'), delete='tr')}}
>
> in a table. Using the link will perform the callback and delete the table 
> row.
>
> target and delete can be combined.
>
> Em sex., 24 de jan. de 2020 às 16:00, mostwanted  > escreveu:
>
>> Thanks Ramos but the target parameter still doesn't solve the issue. When 
>> i add the target parameter & the target div it deletes but the page ends up 
>> reload endlessly!
>>
>> On Friday, January 24, 2020 at 1:49:37 PM UTC+2, Ramos wrote:
>>>
>>> I guess you need to set the target param
>>> see here...
>>> https://groups.google.com/forum/#!topic/web2py/V_e_c7h0l3A  
>>>
>>> Em sex., 24 de jan. de 2020 às 08:54, mostwanted  
>>> escreveu:
>>>
 I have been using the ajax function alot lately, there is a level of 
 neatness about it. 
 What I wanna do is to make a delete by clicking a button but avoid a 
 page reload, I used the ajax callback function, but the problem is that 
 after clicking delete it shows working but nothing happens, it will only 
 delete the desired entry after i have refreshed the page, thats not what i 
 want, i want to click delete, see the item get deleted but without the 
 page 
 refresh!

 *MY CODE*

 *CONTROLLER*







 *def deleteQuoteItem():if db(db.quotation.id == request.args(0, 
 cast=int)).delete():if db(db.quotation.id is not None):
 redirect(URL('View_Quotation', args=(session.detailsQuote.id)))
 else:redirect(URL('registeredClients'))return locals()*

 *VIEW*
 {{=A('Delete',callback=URL('deleteQuoteItem', args=quote.id))}}

 Regards;

 Mostwanted

 -- 
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 --- 
 You received this message because you are subscribed to the Google 
 Groups "web2py-users" group.
 To unsubscribe from this group and stop receiving emails from it, send 
 an email to web...@googlegroups.com.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/web2py/bb3b7374-b5f2-4e07-9d84-ee4a2e91c716%40googlegroups.com
  
 
 .

>>> -- 
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to web...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/web2py/7bb08f29-f1a6-45b5-abfb-1b5542be79ac%40googlegroups.com
>>  
>> 
>> .
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/84050ff9-d371-48b7-8a87-36fb6663552a%40googlegroups.com.


Re: [web2py] Using Ajax Callback() in a delete functions

2020-01-24 Thread António Ramos
Have you read this ???


A

This helper is used to build links.

>>> print A('', XML('me'),
>>> _href='http://www.web2py.com')>> href='http://www.web2py.com'>clickme

Instead of _href you can pass the URL using the callback argument. For
example in a view:

{{=A('click me', callback=URL('myaction'))}}

and the effect of pressing the link will be an ajax call to "myaction"
instead of a redirection. In this case, optionally you can specify two more
arguments: target and delete:

{{=A('click me', callback=URL('myaction'), target='t')}}

and the response of the ajax callback will replace the content (inner HTML)
of the DIV with id equal to "t".

{{=A('click me', callback=URL('myaction'), delete='div#b')}}

and upon response, the closest tag matching "div#b" will be deleted. In
this case, the whole DIV with the link will be deleted.

A typical application is:

{{=A('click me', callback=URL('myaction'), delete='tr')}}

in a table. Using the link will perform the callback and delete the table
row.

target and delete can be combined.

Em sex., 24 de jan. de 2020 às 16:00, mostwanted 
escreveu:

> Thanks Ramos but the target parameter still doesn't solve the issue. When
> i add the target parameter & the target div it deletes but the page ends up
> reload endlessly!
>
> On Friday, January 24, 2020 at 1:49:37 PM UTC+2, Ramos wrote:
>>
>> I guess you need to set the target param
>> see here...
>> https://groups.google.com/forum/#!topic/web2py/V_e_c7h0l3A
>>
>> Em sex., 24 de jan. de 2020 às 08:54, mostwanted 
>> escreveu:
>>
>>> I have been using the ajax function alot lately, there is a level of
>>> neatness about it.
>>> What I wanna do is to make a delete by clicking a button but avoid a
>>> page reload, I used the ajax callback function, but the problem is that
>>> after clicking delete it shows working but nothing happens, it will only
>>> delete the desired entry after i have refreshed the page, thats not what i
>>> want, i want to click delete, see the item get deleted but without the page
>>> refresh!
>>>
>>> *MY CODE*
>>>
>>> *CONTROLLER*
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> *def deleteQuoteItem():if db(db.quotation.id == request.args(0,
>>> cast=int)).delete():if db(db.quotation.id is not None):
>>> redirect(URL('View_Quotation', args=(session.detailsQuote.id)))
>>> else:redirect(URL('registeredClients'))return locals()*
>>>
>>> *VIEW*
>>> {{=A('Delete',callback=URL('deleteQuoteItem', args=quote.id))}}
>>>
>>> Regards;
>>>
>>> Mostwanted
>>>
>>> --
>>> Resources:
>>> - http://web2py.com
>>> - http://web2py.com/book (Documentation)
>>> - http://github.com/web2py/web2py (Source code)
>>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "web2py-users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to web...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/web2py/bb3b7374-b5f2-4e07-9d84-ee4a2e91c716%40googlegroups.com
>>> 
>>> .
>>>
>> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/7bb08f29-f1a6-45b5-abfb-1b5542be79ac%40googlegroups.com
> 
> .
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CAEM0BxMoxhok9vtmDHgkjHEMOXCyu_46CS8n2gOV-TQ3zjr25g%40mail.gmail.com.


Re: [web2py] Using Ajax Callback() in a delete functions

2020-01-24 Thread mostwanted
Thanks Ramos but the target parameter still doesn't solve the issue. When i 
add the target parameter & the target div it deletes but the page ends up 
reload endlessly!

On Friday, January 24, 2020 at 1:49:37 PM UTC+2, Ramos wrote:
>
> I guess you need to set the target param
> see here...
> https://groups.google.com/forum/#!topic/web2py/V_e_c7h0l3A  
>
> Em sex., 24 de jan. de 2020 às 08:54, mostwanted  > escreveu:
>
>> I have been using the ajax function alot lately, there is a level of 
>> neatness about it. 
>> What I wanna do is to make a delete by clicking a button but avoid a page 
>> reload, I used the ajax callback function, but the problem is that after 
>> clicking delete it shows working but nothing happens, it will only delete 
>> the desired entry after i have refreshed the page, thats not what i want, i 
>> want to click delete, see the item get deleted but without the page refresh!
>>
>> *MY CODE*
>>
>> *CONTROLLER*
>>
>>
>>
>>
>>
>>
>>
>> *def deleteQuoteItem():if db(db.quotation.id == request.args(0, 
>> cast=int)).delete():if db(db.quotation.id is not None):
>> redirect(URL('View_Quotation', args=(session.detailsQuote.id)))
>> else:redirect(URL('registeredClients'))return locals()*
>>
>> *VIEW*
>> {{=A('Delete',callback=URL('deleteQuoteItem', args=quote.id))}}
>>
>> Regards;
>>
>> Mostwanted
>>
>> -- 
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to web...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/web2py/bb3b7374-b5f2-4e07-9d84-ee4a2e91c716%40googlegroups.com
>>  
>> 
>> .
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/7bb08f29-f1a6-45b5-abfb-1b5542be79ac%40googlegroups.com.


Re: [web2py] Using Ajax Callback() in a delete functions

2020-01-24 Thread António Ramos
I guess you need to set the target param
see here...
https://groups.google.com/forum/#!topic/web2py/V_e_c7h0l3A

Em sex., 24 de jan. de 2020 às 08:54, mostwanted 
escreveu:

> I have been using the ajax function alot lately, there is a level of
> neatness about it.
> What I wanna do is to make a delete by clicking a button but avoid a page
> reload, I used the ajax callback function, but the problem is that after
> clicking delete it shows working but nothing happens, it will only delete
> the desired entry after i have refreshed the page, thats not what i want, i
> want to click delete, see the item get deleted but without the page refresh!
>
> *MY CODE*
>
> *CONTROLLER*
>
>
>
>
>
>
>
> *def deleteQuoteItem():if db(db.quotation.id == request.args(0,
> cast=int)).delete():if db(db.quotation.id is not None):
> redirect(URL('View_Quotation', args=(session.detailsQuote.id)))
> else:redirect(URL('registeredClients'))return locals()*
>
> *VIEW*
> {{=A('Delete',callback=URL('deleteQuoteItem', args=quote.id))}}
>
> Regards;
>
> Mostwanted
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/bb3b7374-b5f2-4e07-9d84-ee4a2e91c716%40googlegroups.com
> 
> .
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CAEM0BxN73pY4pKM7uuza1c74dMwLCEue8bTc%3DmA_k93szj9CTA%40mail.gmail.com.