AABB
AlignmentBehavior
ArriveBehavior
AStar
BFS
BoundingSphere
BVH
BVHNode
Cell
CellSpacePartitioning
CohesionBehavior
CompositeGoal
ConvexHull
Corridor
CostTable
DFS
Dijkstra
Edge
EntityManager
EvadeBehavior
EventDispatcher
Behavior
FollowPathBehavior
FuzzyAND
FuzzyCompositeTerm
FuzzyFAIRLY
FuzzyModule
FuzzyOR
FuzzyRule
FuzzySet
FuzzyTerm
FuzzyVariable
FuzzyVERY
GameEntity
Goal
GoalEvaluator
Graph
GraphUtils
HalfEdge
HeuristicPolicyDijkstra
HeuristicPolicyEuclid
HeuristicPolicyEuclidSquared
HeuristicPolicyManhattan
InterposeBehavior
LeftSCurveFuzzySet
LeftShoulderFuzzySet
LineSegment
Logger
MathUtils
Matrix3
Matrix4
MemoryRecord
MemorySystem
MeshGeometry
MessageDispatcher
MovingEntity
NavEdge
NavMesh
NavMeshLoader
NavNode
Node
NormalDistFuzzySet
OBB
ObstacleAvoidanceBehavior
OffsetPursuitBehavior
OnPathBehavior
Path
Plane
Polygon
Polyhedron
PriorityQueue
PursuitBehavior
Quaternion
Ray
RectangleTriggerRegion
Regular
RightSCurveFuzzySet
RightShoulderFuzzySet
SAT
SeekBehavior
SeparationBehavior
SingletonFuzzySet
Smoother
SphericalTriggerRegion
State
StateMachine
SteeringBehavior
SteeringManager
Task
TaskQueue
Telegram
Think
Time
TriangularFuzzySet
Trigger
TriggerRegion
Vector3
Vehicle
Version
WanderBehavior

size

概述

CostTable 类中的 size 属性指定了表格的大小。可以通过设置该属性来调整表格的行数和列数,以适应不同的数据量和显示需求。

该属性的默认值为 { rows: 10, columns: 5 }

用法

通过以下方法可以设置 size 属性:

const costTable = new CostTable('#table', data);
costTable.size = { rows: 20, columns: 8 };

上述代码将 CostTable 对象 costTablesize 属性设置为 { rows: 20, columns: 8 }

参数

size 属性的值应该是一个包含以下两个属性的对象:

属性名称 类型 描述
rows number 表格的行数。默认值为 10
columns number 表格的列数。默认值为 5

必须同时设置 rowscolumns 属性的值。

示例

以下示例将创建一个 CostTable 对象,将 size 属性设置为 { rows: 15, columns: 6 }

const data = [
  ['Product', 'Unit Cost', 'Quantity', 'Total'],
  ['Apple', 1.2, 5, 6],
  ['Banana', 0.9, 10, 9],
  ['Orange', 1.1, 8, 8.8]
];

const costTable = new CostTable('#table', data);
costTable.size = { rows: 15, columns: 6 };

注意事项

  • 如果设置的行数或列数小于数据实际所需,将出现滚动条显示不全的问题。
  • 如果设置的行数或列数大于数据实际所需,将会出现一些空白的行或列。