Categories | Question details Back To List | ||
Combo in grid and name/value problem There is a coulm in my grid defined as "combo" and filed by outside XML source that has name/value pairs. Value is show in grid, but name is send to server (eg. 'AL' -'Alabama' will show Alabama but send AL'). Im using DataProcesor in POST mode and manual update. New rows has corrected values of combo fields ('AL'), but updated rows where combo column was not modified has wrong value - name is send instead of value (eg. 'Alabama' instead 'AL') please help Answer posted by Support on Nov 10, 2008 08:06 When loading initial data in grid , be sure to use values in XML <cell>AL</cell> - correct <cell>Alabama</cell> - incorrect Answer posted on Nov 11, 2008 23:50 My XML source for combo: <complete> Where '1' is name and 'Aba' is value. Every time I need to get name, but some times I get value. Answer posted by Support on Nov 12, 2008 04:18 When you loading grid, it maps the current value of cell to the option from combo as cell_value = ption@value So if you have for combo <complete> <option value="1" >Aba</option> <option value="2" >Bcd</option> </complete> grid must have <row ... <cell>1</cell> // not the Aba Answer posted on Nov 12, 2008 05:29 in sample file: dhtmlxGrid\samples\interaction_other_components\gridCombo.xml I found lines: <complete> So, we have name and values pair '1:one' etc. like in my example Answer posted by Support on Nov 12, 2008 05:56 Yes, this is syntax for defining column options. But in addition to this, you have some cell, which has initial value from mentioned list <cell xmlcontent="2">1<complete> <option value="1">one</option> <option value="2">two</option> <option value="3">three</option> <option value="4">four</option> <option value="5">five</option> <option value="6">six</option> <option value="7">seven</option> <option value="8">eight</option> <option value="9">nine</option> <option value="10">ten</option> </complete> </cell> XML for cell tag has 1 as content and , it will be correctly mapped to the option with value="1", and rendered in grid as "One" Answer posted on Nov 12, 2008 06:03 So, the value option is for initial purpose only? In other words: its not possible to use this value as a key in combo? Answer posted by Support on Nov 12, 2008 06:12 Value inside cell tag - initial value which can be changed All grid's api will work with values only (1), the name ("one") will be used for rendering only and will not be used in API calls. If inital value was set incorrectly "One" instead of "1" ( or just a " 1 " ) it will be treated as some custom option, and not mapped to first option of combo. |