CFGRID bind problem


hi, have problem binding fields cfgrid.

when i'm populating grid using query attribute binding not working. problem accessing row's cell; mygrid.selecteditem object exists when use mygrid.selecteditem.columnname nothing returns.
howerever when use same code , populate grid manually or via loop in cfgridrow code working. (commented in code)
now second option seems solution but...
when db column empty cf not populating column empty value takes next data available list in data attribute

anyone experienced anoying problem before , me solution ?

thanks help!


here code:

[hi]
<cfgrid query="query" name="mygrid" rowheaders="no" selectmode="row">
<cfgridcolumn name="lname" header="lastname" />
<cfgridcolumn name="fname" header="firstname" />
<!--- <cfloop query="query">
<cfgridrow data="#lname#,#fname#" />
</cfloop> --->
</cfgrid>
<cfinput type="text" name="firstname" label="first name:" bind="{mygrid.selecteditem.fname}" />
[/hi]


ps. forgot mention we're running on cf 7.0.1

this tricky 1 me also, simple fix.

when using query, mygrid.selecteitem.columnname case sensitive, , has match column name in query select statement.
look @ code below example.

if using select * sql statement, grid selecteditem column name has match db spelling.

<cfquery name="x" datasource="#application.datasource#">
select
orderid, customerid <!--- case of column names has match selecteditem column name --->
from orders
</cfquery>
<cfform name="y" format="flash">
<cfgrid query="x" name="mygrid" rowheaders="no">
<cfgridcolumn name="orderid" header="order" /><!--- notice uppercase in name, matches --->
<cfgridcolumn name="customerid" header="customer" />
</cfgrid>
<cfinput type="text" name="cid" label="customer" bind="{mygrid.selecteditem.customerid}"/>
<!--- notice case matches select statement
changing case of letter in bind or in select sql cause binding not work.
--->
</cfform>


More discussions in ColdFusion Rich Forms


adobe

Comments

Popular posts from this blog

opencv3, tbb and rasp pi 2 - Raspberry Pi Forums

small ethernet problem - Raspberry Pi Forums

Multithumb configuration params not working? - Joomla! Forum - community, help and support