Answered
Master cfgrid - detail form fields
I have a cfgrid that uses data binding to display master
(summary) data. I want the user to be able to select one of the
rows in the datagrid and not only have the summary data show in
form fields below the grid (that works well so far), but I want to
pass the hidden keyfield to a cfc in order to run a single record
query for the detail data and show that as well on the fly. I used
a cfinvoke to pass the key field to a cfc, returning a query
recordset and display the detailed fields in the form. All is
working if I hardcode the keyfield integer (diadocumentkey) and I
can even display the keyfield in the form below, but I have tried
many variations trying to get the selected record keyfield value
for use in the cfinvoke of the cfc without success. Is this not
possible? Is there another way? I tested bringing all the fields
over to the datagrid, but since the number of records possible is
very large, there is a big performance hit. Some users will read
and some will be able to edit and delete the record. My JavaScript
is weak, so perhaps there is a way using it. Here's some snippets
of the code:
...
<cfform name="frmSearchGrid" id="frmSearchGrid" format="html" method="post" >
...
<cfgrid name="searchGrid"
bindonload="true"
format="html"
pagesize="#intShowRows#"
preservePageOnSort="true"
bind="cfc:#strcomponentpath#readdiadocumentgrid({cfgridpage},{cfgridpagesize},{cfgridsortcolumn},{cfgridsortdirection},{frmSearchGrid:strsearchdb},{frmSearchGrid:strsearchmetadata},{frmSearchGrid:dtedateRangeFrom},{frmSearchGrid:dtedateRangeTo})">
<cfgridcolumn name="diadocumentkey" header="diadocumentkey" display="false" />
<cfgridcolumn name="diadocno" header="docno" width="70" />
<cfgridcolumn name="diadeliverydate" header="doc date" width="75" />
<cfgridcolumn name="diadocsubject" header="subject" width="238" />
</cfgrid>
...
Key:<cfinput type="text" name="readdiadocumentkey" id="readdiadocumentkey" readonly="True" label="Key:" required="No" bind="{searchGrid.diadocumentkey}" style="width:70px" disabled="true" />
...
<cfinvoke component="MwsComponents/DocumentImaging/diaDAO" method="readdiadocumentdetail" returnvariable="rstDetailRecord" >
<!---only this works --->
<cfinvokeargument name="intdiadocumentkey" value="193">
<cfinvokeargument name="strsearchdb" value="DocumentImaging" />
<!---all these fail --->
<!--- <cfinvokeargument name="intdiadocumentkey" value="#searchGrid.selectedItem.diadocumentkey#" /> --->
<!--- <cfinvokeargument name="intdiadocumentkey" value="#frmSearchGrid.searchGrid.selectedItem.diadocumentkey#" /> --->
<!--- <cfinvokeargument name="intdiadocumentkey" value="#frmSearchGrid.readdiadocumentkey#" /> --->
<!--- <cfinvokeargument name="intdiadocumentkey" value="#ColdFusion.getElementValue('searchGrid','frmSearchGrid','diadocumentkey')#" /> --->
<!--- <cfinvokeargument name="intdiadocumentkey" value="{frmSearchGrid:readdiadocumentkey}" /> --->
<!--- <cfinvokeargument name="intdiadocumentkey" value="{diadocumentkey}" /> --->
<!--- <cfinvokeargument name="intdiadocumentkey" bind="{searchGrid.diadocumentkey}"> --->
<!--- <cfinvokeargument name="intdiadocumentkey" value="{searchGrid.diadocumentkey}"> --->
<!--- <cfinvokeargument name="intdiadocumentkey" value="searchGrid.diadocumentkey"> --->
<!--- <cfinvokeargument name="intdiadocumentkey" value="#searchGrid.diadocumentkey#"> --->
<!--- <cfinvokeargument name="intdiadocumentkey" value="#readdiadocumentkey#"> --->
<!--- <cfinvokeargument name="intdiadocumentkey" value="#frmSearchGrid.readdiadocumentkey#"> --->
</cfinvoke>
Doc. Sequence:<cfinput type="text" name="editdiaseq" readonly="True" disabled="true" label="Document Sequence:" required="No" value="#rstDetailRecord.diaseq#" style="width:30px" />
</cfform>
...
<cfform name="frmSearchGrid" id="frmSearchGrid" format="html" method="post" >
...
<cfgrid name="searchGrid"
bindonload="true"
format="html"
pagesize="#intShowRows#"
preservePageOnSort="true"
bind="cfc:#strcomponentpath#readdiadocumentgrid({cfgridpage},{cfgridpagesize},{cfgridsortcolumn},{cfgridsortdirection},{frmSearchGrid:strsearchdb},{frmSearchGrid:strsearchmetadata},{frmSearchGrid:dtedateRangeFrom},{frmSearchGrid:dtedateRangeTo})">
<cfgridcolumn name="diadocumentkey" header="diadocumentkey" display="false" />
<cfgridcolumn name="diadocno" header="docno" width="70" />
<cfgridcolumn name="diadeliverydate" header="doc date" width="75" />
<cfgridcolumn name="diadocsubject" header="subject" width="238" />
</cfgrid>
...
Key:<cfinput type="text" name="readdiadocumentkey" id="readdiadocumentkey" readonly="True" label="Key:" required="No" bind="{searchGrid.diadocumentkey}" style="width:70px" disabled="true" />
...
<cfinvoke component="MwsComponents/DocumentImaging/diaDAO" method="readdiadocumentdetail" returnvariable="rstDetailRecord" >
<!---only this works --->
<cfinvokeargument name="intdiadocumentkey" value="193">
<cfinvokeargument name="strsearchdb" value="DocumentImaging" />
<!---all these fail --->
<!--- <cfinvokeargument name="intdiadocumentkey" value="#searchGrid.selectedItem.diadocumentkey#" /> --->
<!--- <cfinvokeargument name="intdiadocumentkey" value="#frmSearchGrid.searchGrid.selectedItem.diadocumentkey#" /> --->
<!--- <cfinvokeargument name="intdiadocumentkey" value="#frmSearchGrid.readdiadocumentkey#" /> --->
<!--- <cfinvokeargument name="intdiadocumentkey" value="#ColdFusion.getElementValue('searchGrid','frmSearchGrid','diadocumentkey')#" /> --->
<!--- <cfinvokeargument name="intdiadocumentkey" value="{frmSearchGrid:readdiadocumentkey}" /> --->
<!--- <cfinvokeargument name="intdiadocumentkey" value="{diadocumentkey}" /> --->
<!--- <cfinvokeargument name="intdiadocumentkey" bind="{searchGrid.diadocumentkey}"> --->
<!--- <cfinvokeargument name="intdiadocumentkey" value="{searchGrid.diadocumentkey}"> --->
<!--- <cfinvokeargument name="intdiadocumentkey" value="searchGrid.diadocumentkey"> --->
<!--- <cfinvokeargument name="intdiadocumentkey" value="#searchGrid.diadocumentkey#"> --->
<!--- <cfinvokeargument name="intdiadocumentkey" value="#readdiadocumentkey#"> --->
<!--- <cfinvokeargument name="intdiadocumentkey" value="#frmSearchGrid.readdiadocumentkey#"> --->
</cfinvoke>
Doc. Sequence:<cfinput type="text" name="editdiaseq" readonly="True" disabled="true" label="Document Sequence:" required="No" value="#rstDetailRecord.diaseq#" style="width:30px" />
</cfform>
