• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

CFGrid combobox list getting mixed up with other grids in the page

New Here ,
Sep 14, 2016 Sep 14, 2016

Copy link to clipboard

Copied

Hi,

Currently we have ColdFusion 2016 Update 1 installed on our deployed server. After we upgraded our CF version from 9 to 2016, all cfgrids combobx columns started behaving a bit strange. Grid combobox columns are not displaying the exact values defined in cfgridcolumn values and valuesdisplay list. We have some links on the grid that opens up a pop-up with cfgrid. This grid combobox list data is getting mapped to the parent grid combobox list.

For ex: If the parent grid second column is a combobox and values="true,false" and the pop-up grid second column combobox values="FE,TSE,TS", If I try to edit pop-up grid second column, true/false is appearing in the combobox list.

Strangely this is happening with all the grids that have editable combobox columns. Can you please help me with the

Grids settings is something like:

<cfset gridArgs = structNew()>
<cfset gridArgs.name = "LoansGrid">
<cfset gridArgs.pageSize = 20>
<cfset gridArgs.format = "html">
<cfif SERVER.ColdFusion.ProductVersion lt 9>
<cfset gridArgs.width = "99%">
</cfif>
<cfset gridArgs.autowidth = "no">
<cfset gridArgs.bindOnLoad = "true">
<cfset gridArgs.bind = "cfc:XXX.MVP.components.Manager.getRecords({cfgridpage},{cfgridpagesize},{cfgridsortcolumn},{cfgridsortdirection},{Filter})">
<cfset gridArgs.stripeRows = true>
<cfset gridArgs.selectColor = "##D9E8FB">
<cfset gridArgs.selectmode = "edit">
<cfset gridArgs.onchange = "cfc:XXX.MVP.components.Manager.editRecord({cfgridaction},{cfgridrow},{cfgridchanged})">

<style>
td div, table div, form div { margin:0; } .x-grid-header { margin:0; } .x-grid-hd-row td { line-height:normal; }
</style>

<cfform name="EEEForm">

<cfinput type="hidden" name="Filter" value="#id#">

<cfgrid attributeCollection="#gridArgs#">
<cfgridcolumn name='Links' header='Links' display="true" width="170" select="no">
<cfgridcolumn name='Record_ID' header='Record ID' display="false" select="no">
<cfgridcolumn name="ID" header="ID"  display="false" select="no">
<cfgridcolumn name="Number" header="Number"  display="true" bold="yes">
<cfgridcolumn name="IncludeInRun" header="Include in Run"  display="true" values="1,0" valuesdisplay="True,False">
<cfgridcolumn name="Status" header="Status"  display="true">
<cfgridcolumn name="LastName" header="Last Name"  display="true">
<cfgridcolumn name="ProductType" header="Product Type"  display="true" values="#productType#" valuesdisplay="#productType#">
<cfgridcolumn name="PropertyType" header="Property Type"  display="true" values="#propertyType#" valuesdisplay="#propertyType#">
........
</cfgrid>
</cfform>

Views

600

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 18, 2016 Sep 18, 2016

Copy link to clipboard

Copied

deepthit36620990 wrote:

For ex: If the parent grid second column is a combobox and values="true,false" and the pop-up grid second column combobox values="FE,TSE,TS", If I try to edit pop-up grid second column, true/false is appearing in the combobox list.


<cfgridcolumn name="IncludeInRun" header="Include in Run" display="true" values="1,0" valuesdisplay="True,False">

Could you verify that you are comparing values with values and valuesdisplay with valuesdisplay? In other words, something like this

<cfgridcolumn name="col_x" header="hdr_x" display="true" values="1,0" valuesdisplay="True,False">

<cfgridcolumn name="col_y" header="hdr_y" display="true" values="FE,TSE,TS" valuesdisplay="varName1,varName2,varName3">

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 18, 2016 Sep 18, 2016

Copy link to clipboard

Copied

Yes. I am comparing values with values and Valuesdisplay with valuesdisplay.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 19, 2016 Sep 19, 2016

Copy link to clipboard

Copied

deepthit36620990 wrote:

Yes. I am comparing values with values and Valuesdisplay with valuesdisplay.

I asked because you mentioned

values="1,0"

values="true,false"

valuesDisplay="true,false"

Could you show us the entire code for both grids?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 19, 2016 Sep 19, 2016

Copy link to clipboard

Copied

Sure.

Grid 1 (Page):

<cfset gridArgs = structNew()>
<cfset gridArgs.name = "LoansGrid">
<cfset gridArgs.pageSize = 20>
<cfset gridArgs.format = "html">
<cfif SERVER.ColdFusion.ProductVersion lt 9>
<cfset gridArgs.width = "99%">
</cfif>
<cfset gridArgs.autowidth = "no">
<cfset gridArgs.bindOnLoad = "true">
<cfset gridArgs.bind = "cfc:XXX.MVP.components.Manager.getRecords({cfgridpage},{cfgridpagesize},{cfgridsortcolum n},{cfgridsortdirection},{Filter})">
<cfset gridArgs.stripeRows = true>
<cfset gridArgs.selectColor = "##D9E8FB">
<cfset gridArgs.selectmode = "edit">
<cfset gridArgs.onchange = "cfc:XXX.MVP.components.Manager.editRecord({cfgridaction},{cfgridrow},{cfgridchanged})">

<style>
td div, table div, form div { margin:0; } .x-grid-header { margin:0; } .x-grid-hd-row td { line-height:normal; }
</style>

<cfform name="EEEForm">

<cfinput type="hidden" name="Filter" value="#id#">

<cfgrid attributeCollection="#gridArgs#">
<cfgridcolumn name='Links' header='Links' display="true" width="170" select="no">
<cfgridcolumn name='Record_ID' header='Record ID' display="false" select="no">
<cfgridcolumn name="ID" header="ID"  display="false" select="no">
<cfgridcolumn name="Number" header="Number"  display="true" bold="yes">
<cfgridcolumn name="IncludeInRun" header="Include in Run"  display="true" values="1,0" valuesdisplay="True,False">
<cfgridcolumn name="Status" header="Status"  display="true">
<cfgridcolumn name="LastName" header="Last Name"  display="true">
<cfgridcolumn name="ProductType" header="Product Type"  display="true" values="#productType#" valuesdisplay="#productType#">
<cfgridcolumn name="PropertyType" header="Property Type"  display="true" values="#propertyType#" valuesdisplay="#propertyType#">
........
</cfgrid>
</cfform>

Grid 2 (Pop-up window):

<cfset Id = application.user.MVP.Id[session.Auth.GetUser_Record_ID()]>
<cfset Name = application.user.MVP.Name[session.Auth.GetUser_Record_ID()]>

<!--- Set-up variables for Grid --->
<cfscript>

mappingFields = Application.MVP.Data.getMappingFields();
exitStrategies = Application.MVP.Strategies.getExitStrategies();
projectionsList = Application.MVP.Projections.getProjections();

exitStrategyName = ValueList(exitStrategies.ExitStrategyName);
projectionId = ValueList(projectionsList.ProjectionId);
projectionName = ValueList(projectionsList.ProjectionName);
projectionType = ValueList(projectionsList.ProjectionType);

statusCodes = 'XX,YY,ZZ,AA,BB';

</cfscript>

<cfif (isDefined('URL.scope') and URL.scope neq 'global')>
<cfscript>
  portfolioLoans = Application.MVP.Data.getData(Id);
  dataList = ValueList(TestData.Number);
</cfscript>
</cfif>

<cfscript>

<!--- Defining only few for company security--->

ProjectionUnits = 'Monthly,Annualized';

ProjectionUnitsDefaults = 'CPR,CDR,SMM,MDR';

</cfscript>

<!--- Grid Definition --->

<cfset projectionGridArgs = structNew()>
<cfset projectionGridArgs.name = "ProjectionsGrid">
<cfset projectionGridArgs.pageSize = 16>
<cfset projectionGridArgs.format = "html">

<cfif SERVER.ColdFusion.ProductVersion lt 9>
<!--- <cfset projectionGridArgs.width = "99%">ColdFusion 9 does not support % width --->
<cfset projectionGridArgs.selectOnLoad = "yes"><!--- We need to select a record for proper "Add" form bindings if needed --->
<cfelse><!--- In ColdFusion 9, we can add/remove rows straight from within the grid --->
<!--- We need to decide which projections can be modified and how (Insert/Update/Delete)... --->
<cfif isDefined("URL.scope") and URL.scope neq 'global'>
    <cfif IsDefined("URL.testId")>
            <cfswitch expression="#URL.type#">
                <cfcase value="Expenses">
                    <cfset projectionGridArgs.delete = "Yes">
                    <cfset projectionGridArgs.Insert = "Yes">
                </cfcase>
                <cfdefaultcase>
                    <cfset projectionGridArgs.delete = "No">
                    <cfset projectionGridArgs.Insert = "No">
                </cfdefaultcase>
            </cfswitch>
        <cfelse>
            <cfswitch expression="#URL.type#">
                <cfcase value="Expenses">
                    <cfset projectionGridArgs.delete = "Yes">
                    <cfset projectionGridArgs.Insert = "Yes">
                </cfcase>
                <cfdefaultcase>
                    <cfset projectionGridArgs.delete = "No">
                    <cfset projectionGridArgs.Insert = "No">
                </cfdefaultcase>
            </cfswitch>
    </cfif>
<cfelse><!--- If we are pulling up Global projections that are fully editable --->
    <cfset projectionGridArgs.delete = "Yes">
    <cfset projectionGridArgs.Insert = "Yes">
</cfif>
</cfif>

<cfset projectionGridArgs.autowidth = "yes">
<cfset projectionGridArgs.bindOnLoad = "true">
<cfset projectionGridArgs.bind = "cfc:MVP.components.ProjectionsManager.getRecords({cfgridpage},{cfgridpagesize},{cfgridsortcolumn},{cfgridsortdirection},{tableName},{dataFilter},{testFilter})">
<cfset projectionGridArgs.stripeRows = true>
<cfset projectionGridArgs.selectColor = "##D9E8FB">
<cfset projectionGridArgs.selectmode = "edit">
<cfset projectionGridArgs.onchange = "cfc:MVP.components.ProjectionsManager.editRecord({cfgridaction},{cfgridrow},{cfgridchanged},{tableName},{dataFilter},{testFilter})">
<cfset projectionGridArgs.deleteButton = "Delete">
<cfset projectionGridArgs.InsertButton = "Insert">

<!---<cfdump var="#gridargs#" expand="no" >
<cfdump var="#URL#" expand="no" > --->

<cfform name="ProjectionForm">
<div class="row">
<div class="col-md-8">
<cfif (isDefined('URL.scope') and URL.scope neq 'global') or IsDefined('URL.testID')>


    <cfif IsDefined("URL.type")>
        <cfinput type="hidden" name="dataFilter" value="#Id#">
        <cfinput type="hidden" name="testFilter" value="#IIF(NOT isDefined('URL.testID'),DE('0'),'URL.testID')#">
        <cfinput type="hidden" name="tableName" value="MVP_Projections_#URL.type#">
        <cfgrid attributeCollection="#projectionGridArgs#">
            <cfgridcolumn name='ProjectionValueID' header='Projection Value Record ID' display="false" select="no">
            <cfgridcolumn name=Record_ID' header='Record ID' display="false" select="no">
            <cfgridcolumn name='ID' header='ID' display="false" select="no">
            <cfgridcolumn name='ProjectionTable' header='Projection Table' display="false" select="no">
            <cfgridcolumn name='ProjectionScope' header='Projection Scope' display="false" select="no">
            <cfgridcolumn name='ProjectionType' header='Projection Type' display="false" select="no">
            <cfgridcolumn name='projectionId' header='Projection Id' display="false">
                <cfgridcolumn name='Links' header='Links' display="true" select="no" width="45">
            <cfgridcolumn name='ProjectionName' header='Projection' display="true" select="no" width="80">

        

            <cfswitch expression="#URL.type#">


                <cfcase value="Leverage">
                    <cfgridcolumn name='data1' header=Units'' values="#ProjectionUnits#" valuesdisplay="#ProjectionUnits#">                
                </cfcase>
                <cfcase value="Expenses">
                    <cfgridcolumn name='ProjectionValue' header='Units' values="#ProjectionUnitsDefaults#" valuesdisplay="#ProjectionUnitsDefaults#>                
                    <cfgridcolumn name='SaleFlag' header='Sale Flag'>
                </cfcase>             
            </cfswitch>
        </cfgrid>
    </cfif>
<cfelse><!--- User is looking for Global projections --->
    <cfif IsDefined("URL.type") and URL.Type EQ "List">
        <cfinput type="hidden" name="dataFilter" value="0">
        <cfinput type="hidden" name="testFilter" value="0">
        <cfinput type="hidden" name="tableName" value="MVP_ProjectionList">
        <cfgrid attributeCollection="#projectionGridArgs#">
            <cfgridcolumn name='ProjectionTable' header='Projection Table' display="false" select="no">
            <cfgridcolumn name='ProjectionScope' header='Projection Scope' display="false" select="no">
            <cfgridcolumn name='Links' header='Links' display="true" select="no" width="45">
<cfgridcolumn name='projectionId' header='Projection Id' display="false">
            <cfgridcolumn name='ProjectionType' header='Type' display="true" select="no" width="80">
            <cfgridcolumn name='ProjectionName' header='Projection' display="true" width="120">
        </cfgrid>
    <cfelseif IsDefined("URL.type") and URL.Type EQ "Mapping">
        <cfinput type="hidden" name="dataFilter" value="0">
        <cfinput type="hidden" name="testFilter" value="0">
        <cfinput type="hidden" name="tableName" value="MVP_ProjectionMapping">
        <cfgrid attributeCollection="#projectionGridArgs#">
            <cfgridcolumn name='ProjectionTable' header='Projection Table' display="false" select="no">
            <cfgridcolumn name='ProjectionScope' header='Projection Scope' display="false" select="no">
            <cfgridcolumn name='Links' header='Links' display="true" select="no" width="50">
            <cfgridcolumn name='projectionId' header='Projection Id' display="false">
            <cfgridcolumn name='ProjectionType' header='Type' display="true" select="no" width="80">
            <cfgridcolumn name='ProjectionName' header='Projection' display="true" width="80">
            <cfgridcolumn name='ProjectionPriority' header='Priority'>
            <cfgridcolumn name='MappingField1' header='Field 1'>
            <cfgridcolumn name='MappingField2' header='Field 2'>
            <cfgridcolumn name='MappingField3' header='Field 3'>
        </cfgrid>
    <cfelse>
        <cfinput type="hidden" name="dataFilter" value="0">
        <cfinput type="hidden" name="testFilter" value="0">
        <cfinput type="hidden" name="tableName" value="MVP_ProjectionValues_#URL.type#">
        <cfgrid attributeCollection="#gridArgs#">

            <cfgridcolumn name='ProjectionTable' header='Projection Table' display="false" select="no">
            <cfgridcolumn name='ProjectionScope' header='Projection Scope' display="false" select="no">
            <cfgridcolumn name='ProjectionValueID' header='Projection Value Record ID' display="false" select="no">
            <cfgridcolumn name='Links' header='Links' display="true" select="no" width="25">
<cfgridcolumn name='projectionId' header='Projection Id' display="false">          
<cfgridcolumn name='ProjectionName' header='Projection' display="true" width="80">
            <cfgridcolumn name='ProjectionType' header='Type' display="no" select="no" width="80">
            <cfgridcolumn name='ProjectionPriority' header='Priority' width="50">
            <cfgridcolumn name='MappingValue1' header='Value 1'>
            <cfgridcolumn name='MappingValue2' header='Value 2'>
            <cfgridcolumn name='MappingValue3' header='Value 3'>

            <cfswitch expression="#URL.type#">

     <cfcase value="Leverage">

                    <cfgridcolumn name='data1' header=Units'' values="#ProjectionUnits#" valuesdisplay="#ProjectionUnits#">                

                </cfcase>

                <cfcase value="Expenses">

                    <cfgridcolumn name='ProjectionValue' header='Units' values="#ProjectionUnitsDefaults#" valuesdisplay="#ProjectionUnitsDefaults#>                

                    <cfgridcolumn name='SaleFlag' header='Sale Flag'>

                </cfcase>


            </cfswitch>
        </cfgrid>
    </cfif>
</cfif>
</div>

</div>
</cfform>

Code for opening Grid 2:

function openTestWindow(wName,wTitle,URL,rId,pId,lNum)

    {

 

  try { ColdFusion.Window.destroy(wName,true); }

        catch(e){}

               

        ColdFusion.Window.create(wName,wTitle,URL+'&Record_Id='+pId+'&ID='+rId+'&Number='+lNum,

        {height:500,width:500,modal:true,closable:true,destroyOnClose:true,draggable:true,resizable:true,center:true,initshow:true,minheight:300,minwidth:300 });       

    }

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 19, 2016 Sep 19, 2016

Copy link to clipboard

Copied

Couldn't you reduce the number of if-conditions? There are so many that they obscure the logic. In fact, can you be sure the ifs and elses can never be the same?

In any case, the code contains some obvious errors. Removing them might solve your problem.

I have marked the errors in bold:

<cfgridcolumn name=Record_ID' header='Record ID' display="false" select="no">

<cfgridcolumn name='data1' header=Units'' values="#ProjectionUnits#" valuesdisplay="#ProjectionUnits#">

<cfgridcolumn name='ProjectionValue' header='Units' values="#ProjectionUnitsDefaults#" valuesdisplay="#ProjectionUnitsDefaults#>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 19, 2016 Sep 19, 2016

Copy link to clipboard

Copied

Thanks BKBP for looking at this issue.

Regarding multiple if-conditions, this is a legacy application that got acquired by my company from other company. So business is still trying to gather the business requirements for the application behavior.

I can remove multiple if conditions and test the application to see if the reported issue just vanishes.

The missing double quotation makes are my typo errors. I tried to edit company specific information from the code while posting to this site.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 19, 2016 Sep 19, 2016

Copy link to clipboard

Copied

I understand the situation. You could rewrite the if-conditions for greater clarity.

Take, for example,

<cfif (isDefined("URL.scope") and URL.scope neq "global") or IsDefined("URL.testID")>

<!--- code --->

    <cfif IsDefined("URL.type")>

<!--- code --->

    </cfif>

<!--- code --->

<cfelse>

<!--- code --->

    <cfif IsDefined("URL.type") and URL.Type EQ "List">

<!--- code --->

    <cfelseif IsDefined("URL.type") and URL.Type EQ "Mapping">

<!--- code --->

    </cfif>

<!--- code --->

</cfif>

I would simplify it as follows

<cfset isCheck1 = (isDefined("URL.scope") and URL.scope neq "global") or isDefined("URL.testID")>

<cfset isCheck2 = isDefined("URL.type")>

<cfset isCheck3 = isDefined("URL.type") and URL.Type EQ "List">

<cfset isCheck4 = isDefined("URL.type") and URL.Type EQ "Mapping">

<p>

Debugging data: <br>

<cfoutput>

isCheck1 = #isCheck1# <br>

isCheck2 = #isCheck2# <br>

isCheck3 = #isCheck3# <br>

isCheck4 = #isCheck4#

</cfoutput>

</p>

<cfif isCheck1>

    <cfif isCheck2>

    </cfif>

<cfelse>

    <cfif isCheck3>

    <cfelseif isCheck4>

    </cfif>

</cfif>

An even simpler logic is:

<cfif isCheck1 and isCheck2>

    <p>debugging: condition 1</p>

 

<cfelseif not isCheck1 and isCheck3>

     <p>debugging: condition 2 </p>

 

<cfelseif not isCheck1 and isCheck4>

    <p>debugging: condition 3 </p>

 

</cfif>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 20, 2016 Sep 20, 2016

Copy link to clipboard

Copied

Thanks BKBK. I will refactor my code based on your suggestion.

I also removed all cfif and cfelse blocks from the code and tested the combobox display list. Issue still persists.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 20, 2016 Sep 20, 2016

Copy link to clipboard

Copied

Which are the 2 columns, respectively, in the parent and in the popup grid, causing the problem?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 21, 2016 Sep 21, 2016

Copy link to clipboard

Copied

LATEST

All the combobox columns inside the popup. If we try to open and close the pop-up windows multiple times, then the parent grid combobox issue will occur.

I actually converted all   ColdFusion.Window.create to regular JavaScript: window.open and all the comboboxes started working as expected. Do you think  ColdFusion.Window.create need to have some additional logic apart from the one that I shared on the top?

Copying that code again for your reference.

function openTestWindow(wName,wTitle,URL,rId,pId,lNum)

    {

 

  try { ColdFusion.Window.destroy(wName,true); }

        catch(e){}

               

        ColdFusion.Window.create(wName,wTitle,URL+'&Record_Id='+pId+'&ID='+rId+'&Number='+lNum,

        {height:500,width:500,modal:true,closable:true,destroyOnClose:true,draggable:true,resizab le:true,center:true,initshow:true,minheight:300,minwidth:300 });       

    }

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 19, 2016 Sep 19, 2016

Copy link to clipboard

Copied

Suggestion: choose to use either single-quotes or double-quotes. Indent your code. Something like this:

<cfset Id = application.user.MVP.Id[session.Auth.GetUser_Record_ID()]>

<cfset Name = application.user.MVP.Name[session.Auth.GetUser_Record_ID()]>

<!--- Set-up variables for Grid --->

<cfscript>

mappingFields = Application.MVP.Data.getMappingFields();

exitStrategies = Application.MVP.Strategies.getExitStrategies();

projectionsList = Application.MVP.Projections.getProjections();

exitStrategyName = ValueList(exitStrategies.ExitStrategyName);

projectionId = ValueList(projectionsList.ProjectionId);

projectionName = ValueList(projectionsList.ProjectionName);

projectionType = ValueList(projectionsList.ProjectionType);

statusCodes = "XX,YY,ZZ,AA,BB";

</cfscript>

<cfif (isDefined("URL.scope") and URL.scope neq "global")>

    <cfscript>

      portfolioLoans = Application.MVP.Data.getData(Id);

      dataList = ValueList(TestData.Number);

    </cfscript>

</cfif>

<cfscript>

/* Defining only few for company security */

ProjectionUnits = "Monthly,Annualized";

ProjectionUnitsDefaults = "CPR,CDR,SMM,MDR";

</cfscript>

<!--- Grid Definition --->

<cfset projectionGridArgs = structNew()>

<cfset projectionGridArgs.name = "ProjectionsGrid">

<cfset projectionGridArgs.pageSize = 16>

<cfset projectionGridArgs.format = "html">

<cfif SERVER.ColdFusion.ProductVersion lt 9>

    <!--- <cfset projectionGridArgs.width = "99%">ColdFusion 9 does not support % width --->

    <cfset projectionGridArgs.selectOnLoad = "yes"><!--- We need to select a record for proper "Add" form bindings if needed --->

<cfelse><!--- In ColdFusion 9, we can add/remove rows straight from within the grid --->

    <!--- We need to decide which projections can be modified and how (Insert/Update/Delete)... --->

    <cfif isDefined("URL.scope") and URL.scope neq "global">

        <cfif IsDefined("URL.testId")>

            <cfswitch expression="#URL.type#">

            <cfcase value="Expenses">

            <cfset projectionGridArgs.delete = "Yes">

            <cfset projectionGridArgs.Insert = "Yes">

            </cfcase>

            <cfdefaultcase>

            <cfset projectionGridArgs.delete = "No">

            <cfset projectionGridArgs.Insert = "No">

            </cfdefaultcase>

            </cfswitch>

        <cfelse>

            <cfswitch expression="#URL.type#">

            <cfcase value="Expenses">

            <cfset projectionGridArgs.delete = "Yes">

            <cfset projectionGridArgs.Insert = "Yes">

            </cfcase>

            <cfdefaultcase>

            <cfset projectionGridArgs.delete = "No">

            <cfset projectionGridArgs.Insert = "No">

            </cfdefaultcase>

            </cfswitch>

        </cfif>

    <cfelse><!--- If we are pulling up Global projections that are fully editable --->

        <cfset projectionGridArgs.delete = "Yes">

        <cfset projectionGridArgs.Insert = "Yes">

    </cfif>

</cfif>

<cfset projectionGridArgs.autowidth = "yes">

<cfset projectionGridArgs.bindOnLoad = "true">

<cfset projectionGridArgs.bind = "cfc:MVP.components.ProjectionsManager.getRecords({cfgridpage},{cfgridpagesize},{cfgridso rtcolumn},{cfgridsortdirection},{tableName},{dataFilter},{testFilter})">

<cfset projectionGridArgs.stripeRows = true>

<cfset projectionGridArgs.selectColor = "##D9E8FB">

<cfset projectionGridArgs.selectmode = "edit">

<cfset projectionGridArgs.onchange = "cfc:MVP.components.ProjectionsManager.editRecord({cfgridaction},{cfgridrow},{cfgridchang ed},{tableName},{dataFilter},{testFilter})">

<cfset projectionGridArgs.deleteButton = "Delete">

<cfset projectionGridArgs.InsertButton = "Insert">

<!---<cfdump var="#gridargs#" expand="no" >

<cfdump var="#URL#" expand="no" > --->

<cfform name="ProjectionForm">

    <div class="row">

        <div class="col-md-8">

        <cfif (isDefined("URL.scope") and URL.scope neq "global") or IsDefined("URL.testID")>

            <cfif IsDefined("URL.type")>

                <cfinput type="hidden" name="dataFilter" value="#Id#">

                <cfinput type="hidden" name="testFilter" value="#IIF(NOT isDefined('URL.testID'),DE('0'),'URL.testID')#">

                <cfinput type="hidden" name="tableName" value="MVP_Projections_#URL.type#">

                <cfgrid attributeCollection="#projectionGridArgs#">

                <cfgridcolumn name="ProjectionValueID" header="Projection Value Record ID" display="false" select="no">

                <cfgridcolumn name="Record_ID" header="Record ID" display="false" select="no">

                <cfgridcolumn name="ID" header="ID" display="false" select="no">

                <cfgridcolumn name="ProjectionTable" header="Projection Table" display="false" select="no">

                <cfgridcolumn name="ProjectionScope" header="Projection Scope" display="false" select="no">

                <cfgridcolumn name="ProjectionType" header="Projection Type" display="false" select="no">

                <cfgridcolumn name="projectionId" header="Projection Id" display="false">

                <cfgridcolumn name="Links" header="Links" display="true" select="no" width="45">

                <cfgridcolumn name="ProjectionName" header="Projection" display="true" select="no" width="80">

                <cfswitch expression="#URL.type#">       

                <cfcase value="Leverage">

                <cfgridcolumn name="data1" header="Units" values="#ProjectionUnits#" valuesdisplay="#ProjectionUnits#">               

                </cfcase>

                <cfcase value="Expenses">

                <cfgridcolumn name="ProjectionValue" header="Units" values="#ProjectionUnitsDefaults#" valuesdisplay="#ProjectionUnitsDefaults#">               

                <cfgridcolumn name="SaleFlag" header="Sale Flag">

                </cfcase>            

                </cfswitch>

                </cfgrid>

            </cfif>

        <cfelse><!--- User is looking for Global projections --->

            <cfif IsDefined("URL.type") and URL.Type EQ "List">

                <cfinput type="hidden" name="dataFilter" value="0">

                <cfinput type="hidden" name="testFilter" value="0">

                <cfinput type="hidden" name="tableName" value="MVP_ProjectionList">

                <cfgrid attributeCollection="#projectionGridArgs#">

                <cfgridcolumn name="ProjectionTable" header="Projection Table" display="false" select="no">

                <cfgridcolumn name="ProjectionScope" header="Projection Scope" display="false" select="no">

                <cfgridcolumn name="Links" header="Links" display="true" select="no" width="45">

                <cfgridcolumn name="projectionId" header="Projection Id" display="false">

                <cfgridcolumn name="ProjectionType" header="Type" display="true" select="no" width="80">

                <cfgridcolumn name="ProjectionName" header="Projection" display="true" width="120">

                </cfgrid>

            <cfelseif IsDefined("URL.type") and URL.Type EQ "Mapping">

                <cfinput type="hidden" name="dataFilter" value="0">

                <cfinput type="hidden" name="testFilter" value="0">

                <cfinput type="hidden" name="tableName" value="MVP_ProjectionMapping">

                <cfgrid attributeCollection="#projectionGridArgs#">

                <cfgridcolumn name="ProjectionTable" header="Projection Table" display="false" select="no">

                <cfgridcolumn name="ProjectionScope" header="Projection Scope" display="false" select="no">

                <cfgridcolumn name="Links" header="Links" display="true" select="no" width="50">

                <cfgridcolumn name="projectionId" header="Projection Id" display="false">

                <cfgridcolumn name="ProjectionType" header="Type" display="true" select="no" width="80">

                <cfgridcolumn name="ProjectionName" header="Projection" display="true" width="80">

                <cfgridcolumn name="ProjectionPriority" header="Priority">

                <cfgridcolumn name="MappingField1" header="Field 1">

                <cfgridcolumn name="MappingField2" header="Field 2">

                <cfgridcolumn name="MappingField3" header="Field 3">

                </cfgrid>

            <cfelse>

                <cfinput type="hidden" name="dataFilter" value="0">

                <cfinput type="hidden" name="testFilter" value="0">

                <cfinput type="hidden" name="tableName" value="MVP_ProjectionValues_#URL.type#">

                <cfgrid attributeCollection="#gridArgs#">       

                <cfgridcolumn name="ProjectionTable" header="Projection Table" display="false" select="no">

                <cfgridcolumn name="ProjectionScope" header="Projection Scope" display="false" select="no">

                <cfgridcolumn name="ProjectionValueID" header="Projection Value Record ID" display="false" select="no">

                <cfgridcolumn name="Links" header="Links" display="true" select="no" width="25">

                <cfgridcolumn name="projectionId" header="Projection Id" display="false">         

                <cfgridcolumn name="ProjectionName" header="Projection" display="true" width="80">

                <cfgridcolumn name="ProjectionType" header="Type" display="no" select="no" width="80">

                <cfgridcolumn name="ProjectionPriority" header="Priority" width="50">

                <cfgridcolumn name="MappingValue1" header="Value 1">

                <cfgridcolumn name="MappingValue2" header="Value 2">

                <cfgridcolumn name="MappingValue3" header="Value 3">

                <cfswitch expression="#URL.type#">

                <cfcase value="Leverage">

                <cfgridcolumn name="data1" header="Units" values="#ProjectionUnits#" valuesdisplay="#ProjectionUnits#">               

                </cfcase>

                <cfcase value="Expenses">

                <cfgridcolumn name="ProjectionValue" header="Units" values="#ProjectionUnitsDefaults#" valuesdisplay="#ProjectionUnitsDefaults#">               

                <cfgridcolumn name="SaleFlag" header="Sale Flag">

                </cfcase>

                </cfswitch>

                </cfgrid>

            </cfif>

        </cfif>

        </div>

    </div>

</cfform>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation