Forum
02:07
09/10/2009
Hello,
I am not certain but would like to open a discussion on type casting for jqGrid. While building a viewHelper in Zend Framework for jqGrid I wanted to allow the use of Zend Config for defining column names and params. While doing this I found two things that were issues for this. Zend Config loads both INI and XML files with 100% of their values as strings. It seems on their end there should be some way to explicitly type hint values but currently there is not.
With that said, loading from a Zend Config object I was forced to map out every possible option available in jqGrid as defined in the documentation and iterate through the params and cast them appropriately. I believe, but have yet to confirm, that jqGrid is using === vs == which is requiring an exact type. Everything works fine except for booleans when using JSON.
The value in PHP is converted to "1" when using JSON encode. This obviously is a string and could be casted in both languages as a boolean.
I like the idea of using explicit types so I am leaning toward lobbying Zend to change up their code to allow type hinting in config objects. Alternatively in jqGrid you could cast the values or not use ===. Generally if I am going to use === I will attempt to cast the value before using that operator.
Most Users Ever Online: 715
Currently Online:
61 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66