PHP Classes

Checkboxes/Boolean

Recommend this page to a friend!

      DrasticTools  >  All threads  >  Checkboxes/Boolean  >  (Un) Subscribe thread alerts  
Subject:Checkboxes/Boolean
Summary:BOOL checkbox fail to update Database
Messages:3
Author:Danny Orthwein
Date:2010-04-08 16:52:06
Update:2010-04-08 19:52:45
 

  1. Checkboxes/Boolean   Reply   Report abuse  
Picture of Danny Orthwein Danny Orthwein - 2010-04-08 16:52:06
While searching the forum for an answer I came across some one with a similar problem but no responses.

The issue, as simple as it sounds, is configuring a BOOLEAN column type to update the database. i.e. when checked, value=1 when unchecked value=0,

I have set the datatype to TINYINT which defaults the output to a checkbox without specifying DDTYPEBOOL. Even with DDTYPEBOOL it does not change the values within the database.

Interestingly enough however, if I manually edit the database to value=1 and refresh the page, the checkbox will be checked - but does not change back to 0 when unchecked.

Any insights would be greatly appreciated.

- Danny

  2. Re: Checkboxes/Boolean   Reply   Report abuse  
Picture of dd dd - 2010-04-08 19:21:31 - In reply to message 1 from Danny Orthwein
Hi Danny,

The way it should work is this: the grid tries to automatically deduce the type of the column from the type of the column in the database. A TINYINT column will be displayed as a checkbox and everything including editing the checkbox should work then (just as in examplegrid4 where no explicit column type for the 'present' column is given from javascript).

You can pass an explicit column type DDTYPEBOOL from the calling javascript to overrule the automatic deduction of column types from SQL types, for example if you want an INT to be represented as a chckbox.

So, I guess the fact that editing the checkbox in your situation does not (or partly) work, is due to another reason (maybe editability settings?).
Hope this helps,

regards,

dd

  3. Re: Checkboxes/Boolean   Reply   Report abuse  
Picture of Danny Orthwein Danny Orthwein - 2010-04-08 19:52:45 - In reply to message 2 from dd
Thanks for your response.

I double checked everything tried setting the editable:true still no go.
{name: 'select', type:DDTYPEBOOL, displayname:'Select',editable:true},

Also in the actual database I have this date field set to TINYINT.

If anyone who has this working would be willing to post they're col settings, and data type in their table it would be greatly appreciated.

Any other ideas would be great.