Giter VIP home page Giter VIP logo

Comments (7)

ota-meshi avatar ota-meshi commented on May 24, 2024

こんにちは @fujita1106.
「イベントで取得した値」とはなんでしょうか?可能であればサンプルコードを提供していただけますか?

Hi @fujita1106.
What does "イベントで取得した値"(value obtained at the event) mean? Would you please provide sample code?

from cheetah-grid.

fujita1106 avatar fujita1106 commented on May 24, 2024

listenを使用してセルクリック時に値を取得・代入しています。
値の内容を基にセルの色を変えたいです。
grid.listen(CLICK_CELL, (...args) => listener(args));
const listener = (args) => {
const records = grid.records;
if(records[row]["field"] == "")
{
records[row]["field"] = "value";
//row,fieldで指定したセルの背景色を変更したい。
}
};

thanks

from cheetah-grid.

ota-meshi avatar ota-meshi commented on May 24, 2024

Thank you for provide a sample code.

You can change the style (color etc.) for each record by specifying a function in the style property of the column definition.
I think you can check for changes in the fields of record and use it to change the color for each cell.

See https://future-architect.github.io/cheetah-grid/documents/api/js/column_styles.html#advanced-column-style

カラム定義のstyleプロパティに関数を指定する事でレコードごとにスタイル(色など)を変更することができます。
レコードのフィールドの変更をチェックし、styleプロパティに関数を指定する事でセルごとに色を変えることができると思います。

from cheetah-grid.

fujita1106 avatar fujita1106 commented on May 24, 2024

Thank you for your response.
以下コードで試してみたのですが列の背景色が変わりません
grid.layout.body[0][col].style = {
textAlign:"center",
bgColor: "green"
};
grid.invalidate();
styleプロパティ上は背景色が定義されていそうなのですが...
image

Sorry to ask such a elementary question.

from cheetah-grid.

ota-meshi avatar ota-meshi commented on May 24, 2024

You use the function.

from cheetah-grid.

ota-meshi avatar ota-meshi commented on May 24, 2024

Oh it's not. You need to specify it when defining the column. It cannot be rewritten later using the property.

from cheetah-grid.

fujita1106 avatar fujita1106 commented on May 24, 2024

I got it!
Thanks to you I was able to understand that.

from cheetah-grid.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.