English 中文(简体)
cfwheels - Update ofnested property with ategrated key table
原标题:cfwheels - updating nested properties with a composite key table

我试图找到一个更好的机构,努力更新一个有根基的模型。

我现在ed切地认为,我对案文作了人工界定,以通过将名称定为<代码”来制造碎片。 我的Model[myNestedProperty][#modelID#,#key2id#]>

A. 更新行动......

如果我只使用<条码>myModel.update (params.myModel)

因此,我销毁了与我的Model相同的被nes取财产的所有模式,在这种情况下,它运作。

倒数部分是,如果更新工作失败,则所有封顶的财产都已经消失。

我先尝试在删除这些模型和.save之前对所有模型进行挑选,但出于某种原因,这些模型并不奏效。

类似“fwheel”的眼光是与检查箱建立这种关系,但我需要与文字现场合作,并以我的形式选择项目。


Update

我认识到,我还有一个问题。 基本上,我要扩大这一范围,以便能够利用它跨越多个封闭的财产和关系。

问题在于我确定名字,特别是用于选择降级:

name=“myModel[myNestedProperty][#modelID#,][nestedID]

问题是,不能宣布第二次补贴,因为它将被分配为补贴,而不是使用我选定的价值。

坦率地说,这是我与我的整个时间交织在一起的一个问题。 我通过在控制器中恢复模式来处理这个问题,我只是想到,我还没有解决这个问题。

我是否可以完全使用这些价值观,而且这些价值观是动态的?

请允许我指出,我(已编辑)有一个名字:tcat[34,0][catID]tcat[34,][catID](即目录ID应为第二版)。

所产生的散射结构是

[34,0]{catID = 12,14,18}

[34,]{catID = 12,14,18}

我像“伞式”结构一样,有多种障碍,如:

[34,12]{tID = 34; catID = 12}
[34,14]{tID = 34; catID = 14}
[34,18]{tID = 34; catID = 18}

Is there a way around this?

I m w或king with a lot of composite key nested properties, and if I could have this part alone w或king it would make it a lot easier. I know one way is to update the name with javascript, but I think that would be the (very,very) last res或t.

最佳回答

你们能否让这场尝试?

在母体模型中设置一个警示,以检查<代码> 姓名<>为空白,如果是空白,则可以删除。

<cffunction name="init">
    ...

    <!--- This could also be `beforeValidation` if you want to make `name` required for the child model --->
    <cfset beforeSave("$provisionMyNestedProperty")>
</cffunction>

<cffunction name="$provisionMyNestedProperty">
    <cfscript>
        if (StructKeyExists(this, "myNestedProperty") && IsArray(this.myNestedProperty))
        {
            for (local.i = 1; local.i <= ArrayLen(this.myNestedProperty); local.i++)
            {
                if (!StructKeyExists(this.myNestedProperty[local.i], "name") || !Len(Trim(this.myNestedProperty[local.i].name)))
                    this.myNestedProperty[local.i]._delete = true;
            }
        }
    </cfscript>
</cffunction>

我恳请编辑我的回答,直到我们能禁止解决办法。 希望这给你一个良好的开端。

问题回答

暂无回答




相关问题
JQuery AJAX .load - flash chart doesnt load in IE

An IE issue has me completely stumped. I have a coldfusion page that uses JQuery s AJAX .load function to load in a new flash file that is generated by coldFusion s cfchart tag. This works completely ...

Best Coldfusion Library for OpenID [closed]

I am getting ready to start a project that requires using OpenID within Coldfusion 8. I have found a number of different options and was wondering what has worked the best, get s the most support, ...

Find ColdFusion Generated ID

Is there a way to find the elements generated by ColdFusion s <CFLayout> and <CFLayoutArea> tags? These tags: <cflayout type="tab" name="MyAccount"> <cflayoutarea name="...

ColdFusion COM error

I am upgrading from CF4.5 to CF8. Calls to COM dll s that used to work in version 4.5 now throw a "Complex object types cannot be converted to simple values.." error. The COM object has a few arrays ...

What s the best way to write engine-specific CFML code?

Sometimes it is necessary to write different code for Adobe ColdFusion vs Railo vs OpenBD, due to differences in implementation. Do people have a specific method that they use for this? For example, ...

热门标签