版本
版本 | 功能變動 |
---|---|
11.0 | 和 10.0 差別: 新增 addEffect API |
11.0.7 | 行動端, APP\H5 版本 11.0.70 及以後支援該API。 |
addEffect
方法 | addEffect(type, opts) | 滑鼠點選或者懸浮時,儲存格或所在列字體變化。 |
參數 | type: string, opts: { style: { bold: boolean, italic: boolean, fontFamily: string, strikeThrough: boolean, fontSize: number, subscript: boolean, underLine: { width: number style: string, color: number }, textShadow: boolean, supscript: boolean, color: number }, trigger: string, single: boolean } | type:變化範圍,字串
opts:變化屬性,json 格式 1)style: 字體格式,json 格式
width:線寬,新版決策報表中預設為 0 ,必須設定後才能顯示 style: 線型,字串,solid 實線 ,dashed 虛線 color: number 顏色,十六進制顏色程式碼 例如:underLine:{ width: 2, style: 'solid', color: '#000000' }
2)trigger: 滑鼠的操作,不寫時預設為滑鼠懸浮
3)single:恢復邏輯,布林型,預設 true
trigger為mouseover、single為true:滑鼠懸浮的位置變色,滑鼠懸浮到其他位置,顏色轉移到新位置 trigger為mousedown、single為true:滑鼠點選的位置變色,再次點選該位置顏色恢復/點選其他位置顏色轉移到新位置
|
傳回值 | void | |
行動端 | APP\H5 版本 11.0.70 及以後支援該API。 |
儲存格字體變化
設定【addEffect】第一個參數 【type】值為 【setCellFont】 ,滑鼠點選或者懸浮儲存格,儲存格字體格式變化。
代碼範例
範例1:若獲取到的報表塊物件定義為 【report】 ,滑鼠懸浮時字體顯示為紅色粗體 14 號,離開時恢復。
<!-- 滑鼠懸浮時字體顯示為紅色粗體 14 號,離開時恢復。 -->
report.addEffect('setCellFont', {
style: {
bold: true,
fontSize: 14,
color: 'red'
},
trigger: 'mouseover',
single: true
});
範例2:若獲取到的報表塊物件定義為 【report】 ,滑鼠點選儲存格時字體顯示為紅色粗體 14 號,再次點選時恢復。
<!-- 滑鼠點選儲存格時字體顯示為紅色粗體 14 號,再次點選時恢復。 -->
report.addEffect('setCellFont', {
style: {
bold: true,
fontSize: 14,
color: 'red'
},
trigger: 'mousedown',
single: false
});
範例3:普通報表中,滑鼠懸浮儲存格時字體顯示為紅色粗體 14 號,離開時恢復。
<!-- 滑鼠懸浮儲存格時字體顯示為紅色粗體 14 號,離開時恢復。 -->
_g().addEffect('setCellFont', {
style: {
bold: true,
fontSize: 14,
color: 'red'
},
trigger: 'mouseover',
single: true
});
範例4:普通報表中,滑鼠點選儲存格時字體顯示為紅色粗體 14 號,再次點選時恢復。
<!-- 滑鼠點選儲存格時字體顯示為紅色粗體 14 號,再次點選時恢復。 -->
_g().addEffect('setCellFont', {
style: {
bold: true,
fontSize: 14,
color: 'red'
},
trigger: 'mousedown',
single: false
});
範例5:決策報表中,滑鼠懸浮儲存格時字體顯示為紅色粗體 14 號,離開時恢復。
<!-- 滑鼠懸浮儲存格時字體顯示為紅色粗體 14 號,離開時恢復。 -->
_g().getWidgetByName('report0').addEffect('setCellFont', {
style: {
bold: true,
fontSize: 14,
color: 'red'
},
trigger: 'mouseover',
single: true
});
範例6:決策報表中,滑鼠點選儲存格時字體顯示為紅色粗體 14 號,再次點選時恢復。
<!-- 滑鼠點選儲存格時字體顯示為紅色粗體 14 號,再次點選時恢復。 -->
_g().getWidgetByName('report0').addEffect('setCellFont', {
style: {
bold: true,
fontSize: 14,
color: 'red'
},
trigger: 'mousedown',
single: false
});
應用範例
範例1:滑鼠點選儲存格時字體顯示為紅色粗體 14 號,離開時恢復。點選可下載範本:滑鼠懸浮儲存格字體變化.cpt。
範例2:滑鼠點選儲存格時字體顯示為紅色粗體 14 號,再次點選時恢復。點選可下載範本:滑鼠點選儲存格字體變化.cpt。
儲存格所在列字體變化
設定【addEffect】 第一個參數 【type】值為 【setRowFont】,滑鼠點選或者懸浮儲存格,儲存格所在列字體格式變化。
代碼範例
範例1:若獲取到的報表塊物件定義為 【report】 ,滑鼠懸浮儲存格時,所在列字體顯示為紅色粗體 14 號,移動到其他列恢復。
<!-- 滑鼠懸浮儲存格時,所在列字體顯示為紅色粗體 14 號,移動到其他列恢復。 -->
report.addEffect('setRowFont', {
style: {
bold: true,
fontSize: 14,
color: 'red'
},
trigger: 'mouseover',
single: true
});
範例2:若獲取到的報表塊物件定義為 【report】 ,滑鼠點選儲存格時字體顯示為紅色粗體 14 號,再次點選時恢復。
<!-- 滑鼠點選儲存格時字體顯示為紅色粗體 14 號,再次點選時恢復。 -->
report.addEffect('setRowFont', {
style: {
bold: true,
fontSize: 14,
color: 'red'
},
trigger: 'mousedown',
single: false
});
範例3:普通報表中,滑鼠懸浮儲存格時字體顯示為紅色粗體 14 號,離開時恢復。
<!-- 滑鼠懸浮儲存格時字體顯示為紅色粗體 14 號,離開時恢復。 -->
_g().addEffect('setRowFont', {
style: {
bold: true,
fontSize: 14,
color: 'red'
},
trigger: 'mouseover',
single: true
});
範例4:普通報表中,滑鼠點選儲存格時字體顯示為紅色粗體 14 號,再次點選時恢復。
<!-- 滑鼠點選儲存格時字體顯示為紅色粗體 14 號,再次點選時恢復。 -->
_g().addEffect('setRowFont', {
style: {
bold: true,
fontSize: 14,
color: 'red'
},
trigger: 'mousedown',
single: false
});
範例5:決策報表中,滑鼠懸浮儲存格時字體顯示為紅色粗體 14 號,離開時恢復。
<!-- 滑鼠懸浮儲存格時字體顯示為紅色粗體 14 號,離開時恢復。 -->
_g().getWidgetByName('report0').addEffect('setRowFont', {
style: {
bold: true,
fontSize: 14,
color: 'red'
},
trigger: 'mouseover',
single: true
});
範例6:決策報表中,滑鼠點選儲存格時字體顯示為紅色粗體 14 號,再次點選時恢復。
<!-- 滑鼠點選儲存格時字體顯示為紅色粗體 14 號,再次點選時恢復。 -->
_g().getWidgetByName('report0').addEffect('setRowFont', {
style: {
bold: true,
fontSize: 14,
color: 'red'
},
trigger: 'mousedown',
single: false
});
應用範例
範例1:滑鼠懸浮儲存格時,所在列字體顯示為紅色粗體 14 號,移動到其他列恢復。點選可下載範本:滑鼠懸浮儲存格所在列字體變化.cpt。
範例2:滑鼠點選儲存格時,所在列字體顯示為紅色粗體 14 號,再次點選恢復。點選可下載範本:滑鼠點選儲存格所在列字體變化.cpt。