Hi Jim,
The selectable works perfectly but the reason I am using links is I might
require couple of more additional columns containing check-box.
So links could be used to add more colums
links = [dict(header='field1',body=lambda row:
INPUT(_name='action',_type='checkbox')) ,
dict(header='field2',body=lambda row:
INPUT(_name='action',_type='checkbox'))
]
and i tried making calls through ajax _onclick=ajax() but they are made for
every single selection but i wanted to process them together like
selectable.
eg:
method1 = lambda ids: setindicator(ids)
grid = SQLFORM.grid(
...
selectable=method1
)
if i use selectable on clicking submit the method1 will be called with ids
of the selected rows
similarly I am looking to create something which can pass all the ids and
value of checkbox to the controller.
So If i have 5 elements in the grid the button once clicked should send the
ids of 5 elements and their flag values. Selectable only sends the ids that
are selected but through the links I am looking to get both selected and
not selected ones.
probably like [(id1,1),(id2,0),(id3,1),(id4,0),(id5,1)] 1 - indicating
selected, 0 - indicating not selected
On Saturday, 22 June 2013 00:37:21 UTC+10, Jim S wrote:
>
> Here is how I'm handling it:
>
> grid = SQLFORM.grid(query,fields=fields,create=False,editable=False,
> details=False,deletable=False,csv=False,
> searchable=False, orderby=orderby,
> selectable=lambda ids:redirect(URL('applications',
>
> 'quickOrderConfirm',
> vars=dict(ids=ids
> ))),
> maxtextlength=256,paginate=256)
>
>
> Then in my applications/quickOrderConfirm function I use the following to
> grab the ids:
>
> feedOrderHistoryIds = []
>
>
> if type(request.get_vars.ids) == type('str'):
> feedOrderHistoryIds.append(request.get_vars.ids)
> else:
> for id in request.get_vars.ids:
> feedOrderHistoryIds.append(id)
>
>
> Isn't the prettiest code, but it is working for us.
>
> -Jim
>
>
> On Friday, June 21, 2013 2:00:43 AM UTC-5, PremKumar KrishnaKumar wrote:
>>
>> Hi,
>> I am trying out webapp development using web2py and need your direction
>> in finding a solution
>>
>> I use links to display a check-box in sqlform.grid and in the form I have
>> a button.
>>
>> links = [dict(header='Actioned',body=lambda row:
>> INPUT(_name='action',_type='checkbox'))]
>>
>> Once I click the button I wanted to retrieve all the ids and flag and if
>> it is checked update to 1 else 0.
>>
>> Unfortunately i couldn't figure how to access the values also I don't
>> want to call a controller function for every row but instead wanted to do
>> it for all records displayed in the grid.
>>
>> Would appreciate any direction that you could provide
>>
>>
>>
>>
>>
--
---
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.