Thread Rating:
  • 312 Vote(s) - 2.81 Average
  • 1
  • 2
  • 3
  • 4
  • 5
セルが表示されているレコードが正しく取得できない
11-25-2013, 06:25 PM,
#1
セルが表示されているレコードが正しく取得できない
あるセルに入力された金額の消費税額を、同じレコードの消費税費カラムのセルに表示したいです。

下記のコードでは、常に、「最初にフォーカスを入れたセルのレコード」の消費税フィールドに
値が設定されてしまいます。

なぜでしょうか。

Code:
{define-class public CustomCell {inherits StandardStringCell }
  {constructor public {default ...}
    {construct-super {splice ...}}
  }
  {method public {create-editor}:TextField
    def tf = {super.create-editor}
    {tf.add-event-handler
        {on ValueFinished do
            def yen = {String tf.value}
            {if-non-null r = self.record , col = self.column then
                set r["tax"] = {yen.to-int} * 0.05 & "円"
            }
        }
    }
    {return tf}
  }
}
{define-class public CustomColumn {inherits RecordGridColumn}
  {constructor public {default ...}
    {construct-super {splice ...}}
    set self.cell-spec = CustomCell
  }
}
{let rs:RecordSet =
    {RecordSet
        {RecordFields
            {RecordField "yen", domain = String, nullable? = true, caption = "価格"},
            {RecordField "tax", domain = String, nullable? = true, caption = "消費税"}
        },
        {RecordData}, {RecordData}, {RecordData}, {RecordData}
    }
}
{value
    {RecordGrid
        record-source = rs,
        {CustomColumn "yen"}
    }
}


Messages In This Thread
セルが表示されているレコードが正しく取得できない - by umemura - 11-25-2013, 06:25 PM
Forum Jump:


Users browsing this thread:
1 Guest(s)

MyBB SQL Error

MyBB has experienced an internal SQL error and cannot continue.

SQL Error:
1017 - Can't find file: 'mybb_threadviews' (errno: 2)
Query:
INSERT INTO mybb_threadviews (tid) VALUES('1011')