Support
Quality
Security
License
Reuse
kandi has reviewed smartTable and discovered the below as its top functions. This is intended to give you an instant insight into smartTable implemented functionality, and help decide if they suit your requirements.
English README
历史版本介绍
更多功能详情介绍
apk version 2.0版本下载地址
SmartTable2.0基本使用手册持续更新中
快速配置自动生成表格;
自动计算表格宽高;
表格列标题组合;
表格固定左序列、顶部序列、第一行、列标题、统计行;
自动统计,排序(自定义统计规则);
表格图文、序列号、列标题格式化;
表格各组成背景、文字、网格、padding等配置;
表格批注;
表格内容、列标题点击事件;
缩放模式和滚动模式;
注解模式;
内容多行显示;
分页模式;
首尾动态添加数据;
丰富的格式化;
支持二维数组展示(用于类似日程表,电影选票等);
导入excel(支持颜色,字体,背景,批注,对齐,图片等基本Excel属性);
表格合并单元(支持注解合并,支持自动合并);
支持其他刷新框架SmartRefreshLayout;
可配置表格最小宽度(小于该宽度自动适配);
支持直接List或数组字段转列;
支持Json数据直接转换成表格;
支持表格网格指定行列显示;
支持自动生成表单。
引用
align 设置该列对齐方式,默认居中
type 有ColumnType.Own,ColumnType.Child,两个值可以设置,假设UserInfo 有个属性是Family family对象,你想解析faily对象的属性monther,father两个属性,则需要设置Child,并在monther,father下添加相对应的注解@SmartColumn,否则只解析到Family,默认是Own。
autoMerge 假设你返回的数据格式化之后该列附近数据有相同,则会自动合并成一个单元格,默认不开启合并。
autoCount table 开启显示统计行,设置autoCount为true,则该列可以自动统计,默认为false。
fixed fixed设置为true,该列滚动到最左边时,可以自动固定住。
SmartTable
android自动生成表格框架
总结
这次写了SmartTable,本来没想写那么多,结果越写越多。功能也很完善了,好多新的想法由于之前没有考虑到,无法进一步实现。但对基础的Excel支持我觉得已经很完美了,甚至可以展示Excel中图表(使用SmartChart)。如果你在android端需要使用表格,这个肯定可以满足你的需求,希望有需要的同学可以使用它。
打赏
如果你觉得对你有帮助,客官打个赏!
In SAPUI5 SmartTable on event beforeRebindTable adding some filters
onBeforeRebindTable: function (oEvent) {
var oSmartTable = oEvent.getSource();
if (this._isOnInit == null) this._isOnInit = true;
if (this._isOnInit) {
oSmartTable.applyVariant(
{
filter: {
filterItems: [{
columnKey: "YourSelectedColumn",
exclude: false,
operation: "EQ",
value1: "SomeEnteredValue",
value2: ""
}]
}
}
);
this._isOnInit = false;
}
}
How do I force the SmartTable to load all items?
<SmartTable growingThreshold = "{path:'yourModel>/', formatter:'.formatter.sizeCalculator'}">
sizeCalcualtor: function(oModel){
let count = 0;
for(let i in oModel){
//add item to count;
}
return count;
}
-----------------------
<SmartTable growingThreshold = "{path:'yourModel>/', formatter:'.formatter.sizeCalculator'}">
sizeCalcualtor: function(oModel){
let count = 0;
for(let i in oModel){
//add item to count;
}
return count;
}
Make SmartTable's Selected Row a Custom Color
this.className += " selected";
this.classList.add(“selected”);
-----------------------
this.className += " selected";
this.classList.add(“selected”);
-----------------------
onInit:function(){
var that=this; //'this' refers to the view controller
this.aTrCounter=[]; //counter is used to ensure only 1 row is selected at a time so only 1row is colored at a time. Reason why this is in onInit is to avoid errors due to pagination
},
onDataReceived:function(){
var trs = document.querySelectorAll("tr");
for(var i = 0; i < trs.length; i++){
trs[i].addEventListener("click", function(){
if(that.aTrCounter.length===0) { //1st row selection
this.classList.add("selected"); //'this' no longer refers to view controller, it points to the tr itself
that.aTrCounter.push(this); //add tr into array to be counted & for later changes
}
else if(that.aTrCounter.length>0){ //2nd row selection
if(that.aTrCounter[0]===this){ //if user clicks the same row
this.classList.remove("selected");
that.aTrCounter.pop(); //remove last element from array (in this case, the only element)
} else if(that.aTrCounter[0]!=this){ //if user clicks different row
that.aTrCounter[0].classList.remove("selected");
that.aTrCounter.pop();
this.classList.add("selected");
that.aTrCounter.push(this);
}
}
});
}
}
How do I enable filtering in my SAP UI5 SmartTable?
<SmartTable ...>
<Table ...>
<columns>
<Column
customData:p13nData="{
leadingProperty: 'Version',
columnKey: 'Version',
sortProperty: 'Version',
filterProperty: 'Version' // <---
}">
...
SmartTable control has internal load resource error since 1.74
<script id="sap-ui-bootstrap" src="https://ui5.sap.com/1.74.1/resources/sap-ui-core.js">
<script id="sap-ui-bootstrap" src="resources/sap-ui-cachebuster/sap-ui-core.js">
-----------------------
<script id="sap-ui-bootstrap" src="https://ui5.sap.com/1.74.1/resources/sap-ui-core.js">
<script id="sap-ui-bootstrap" src="resources/sap-ui-cachebuster/sap-ui-core.js">
SAPUI5 routing errors Control with ID app could not be found
<App id="app"> </App>
React linter airbnb proptypes array
SmartTable.propTypes = {
name: React.PropTypes.string.isRequired,
cols: React.PropTypes.arrayOf(React.PropTypes.string),
rows: React.PropTypes.arrayOf(React.PropTypes.string),
};
-----------------------
SmartTable.propTypes = {
name: PropTypes.string.isRequired,
cols: PropTypes.instanceOf(Array),
rows: PropTypes.instanceOf(Array),
};
SmartTable.propTypes = {
name: PropTypes.string.isRequired,
cols: PropTypes.instanceOf(Object),
rows: PropTypes.instanceOf(Array),
};
-----------------------
SmartTable.propTypes = {
name: PropTypes.string.isRequired,
cols: PropTypes.instanceOf(Array),
rows: PropTypes.instanceOf(Array),
};
SmartTable.propTypes = {
name: PropTypes.string.isRequired,
cols: PropTypes.instanceOf(Object),
rows: PropTypes.instanceOf(Array),
};
-----------------------
SmartTable.propTypes = {
name: PropTypes.string.isRequired,
cols: PropTypes.arrayOf(PropTypes.shape({
id: PropTypes.string.isRequried,
value: PropTypes.string,
})
rows: PropTypes.arrayOf(PropTypes.shape({
id: PropTypes.string.isRequried,
value: PropTypes.string,
})
-----------------------
someVal: PropTypes.array, // eslint-disable-line
Yii2 pjax corrupts styles
$(document).on("pjax:success", function() {
$('#smartTable').DataTable({
"paging": false,
"responsive": true,
"dom": 'iftlp',
"bProcessing": true,
"aoColumnDefs": [ // EXCEPT SORTING
{'bSortable': false, 'aTargets': ['no-sort']}
],
});
$('#simpleTable').DataTable({
"responsive": true,
"dom": 't'
});
});
-----------------------
[
'label'=>'Options',
'format' => 'raw',
'value'=>function ($data) {
return Html::a('<i class="glyphicon glyphicon-eye-open"></i>', ['short-message/conversation', 'id'=> $data["id"]], ['onclick' =>'window.location.href=this.getAttribute("href")']);
},
],
['onclick' =>'window.location.href=this.getAttribute("href")']
-----------------------
[
'label'=>'Options',
'format' => 'raw',
'value'=>function ($data) {
return Html::a('<i class="glyphicon glyphicon-eye-open"></i>', ['short-message/conversation', 'id'=> $data["id"]], ['onclick' =>'window.location.href=this.getAttribute("href")']);
},
],
['onclick' =>'window.location.href=this.getAttribute("href")']
How to load sap.ui.comp.smarttable.SmartTable faster?
sap.ui.define([
'jquery.sap.global',
'sap/m/VBoxRenderer',
'sap/m/Column',
// ...
'sap/ui/comp/library',
'sap/ui/comp/providers/TableProvider',
'sap/ui/comp/smartfilterbar/FilterProvider',
'sap/ui/comp/smartvariants/SmartVariantManagement',
// ...
'sap/ui/table/AnalyticalColumn',
'sap/ui/table/AnalyticalTable',
'sap/ui/table/Column',
'sap/ui/table/Table',
'sap/ui/table/TreeTable',
// ...
], function(/*...*/) {/*...*/});
// since 1.58.2
data-sap-ui-async="true" // replaces -preload="async" and -xx-async="true"
"sap.ui5": {
"dependencies": {
"libs": {
"sap.ui.core": {},
"sap.m": {},
"sap.ui.comp": {},
"sap.ui.table": {},
"sap.ui.unified": {}
},
...
},
...
}
-----------------------
sap.ui.define([
'jquery.sap.global',
'sap/m/VBoxRenderer',
'sap/m/Column',
// ...
'sap/ui/comp/library',
'sap/ui/comp/providers/TableProvider',
'sap/ui/comp/smartfilterbar/FilterProvider',
'sap/ui/comp/smartvariants/SmartVariantManagement',
// ...
'sap/ui/table/AnalyticalColumn',
'sap/ui/table/AnalyticalTable',
'sap/ui/table/Column',
'sap/ui/table/Table',
'sap/ui/table/TreeTable',
// ...
], function(/*...*/) {/*...*/});
// since 1.58.2
data-sap-ui-async="true" // replaces -preload="async" and -xx-async="true"
"sap.ui5": {
"dependencies": {
"libs": {
"sap.ui.core": {},
"sap.m": {},
"sap.ui.comp": {},
"sap.ui.table": {},
"sap.ui.unified": {}
},
...
},
...
}
-----------------------
sap.ui.define([
'jquery.sap.global',
'sap/m/VBoxRenderer',
'sap/m/Column',
// ...
'sap/ui/comp/library',
'sap/ui/comp/providers/TableProvider',
'sap/ui/comp/smartfilterbar/FilterProvider',
'sap/ui/comp/smartvariants/SmartVariantManagement',
// ...
'sap/ui/table/AnalyticalColumn',
'sap/ui/table/AnalyticalTable',
'sap/ui/table/Column',
'sap/ui/table/Table',
'sap/ui/table/TreeTable',
// ...
], function(/*...*/) {/*...*/});
// since 1.58.2
data-sap-ui-async="true" // replaces -preload="async" and -xx-async="true"
"sap.ui5": {
"dependencies": {
"libs": {
"sap.ui.core": {},
"sap.m": {},
"sap.ui.comp": {},
"sap.ui.table": {},
"sap.ui.unified": {}
},
...
},
...
}
Filtering Smarttables initial read request
enableAutoBinding="false"
beforeRebindTable="onBeforeRebindTable"
onBeforeRebindTable: function (oEvent) {
var oBindingParams = oEvent.getParameter("bindingParams");
oBindingParams.filters.push(new sap.ui.model.Filter("PropertyX", "EQ", "myProperty"));
}
-----------------------
enableAutoBinding="false"
beforeRebindTable="onBeforeRebindTable"
onBeforeRebindTable: function (oEvent) {
var oBindingParams = oEvent.getParameter("bindingParams");
oBindingParams.filters.push(new sap.ui.model.Filter("PropertyX", "EQ", "myProperty"));
}
-----------------------
enableAutoBinding="false"
beforeRebindTable="onBeforeRebindTable"
onBeforeRebindTable: function (oEvent) {
var oBindingParams = oEvent.getParameter("bindingParams");
oBindingParams.filters.push(new sap.ui.model.Filter("PropertyX", "EQ", "myProperty"));
}
QUESTION
In SAPUI5 SmartTable on event beforeRebindTable adding some filters
Asked 2020-Oct-23 at 05:35My requiremnt is to put some filters on smartTable form my controller.
In Event beforeRebindTable i am using the following code to put filter using this code which is working fine.
onBeforeRebindTable: function (oEvent) {
var oBindingParams = oEvent.getParameter("bindingParams");
statFilter = new sap.ui.model.Filter("Claim_TYPE", "EQ", "1234");
oBindingParams.filters.push(statFilter);
}
But the problem is when the user is clicling on table column on filter again, the filter i am adding in above code is not visible in the selection dialog. User may need to delete this filter, If its not visible in dialog they wont be able to delete it.
I am not able to establish the link why the dialog is not getting updated, or should i add this somewhere else. Thanks Sonal.
ANSWER
Answered 2020-Oct-23 at 05:35 onBeforeRebindTable: function (oEvent) {
var oSmartTable = oEvent.getSource();
if (this._isOnInit == null) this._isOnInit = true;
if (this._isOnInit) {
oSmartTable.applyVariant(
{
filter: {
filterItems: [{
columnKey: "YourSelectedColumn",
exclude: false,
operation: "EQ",
value1: "SomeEnteredValue",
value2: ""
}]
}
}
);
this._isOnInit = false;
}
}
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
No vulnerabilities reported
Save this library and start creating your kit
Save this library and start creating your kit