1.
formulas :
{
isBinding : function()
{
var _provider = this.$.gridPanel.getDataProvider();
return UT.isNotEmpty(_provider) && _provider.filterItems({bw_type:"PR"}).length > 0;
},
},
var _itv = setInterval(function()
{
if (me.formula("isBinding"))
{
clearInterval(_itv);
console.log("completed");
}
else
{
console.log("not completed");
}
}, 300);
2.
<sc-grid id="pkgGridPanel"
class="flex-4"
collapsible="true"
use-state="false"
use-selection="true"
use-dummy="true"
use-selection="[[!singleSelect]]"
selection-mode="[[formula('selectionMode')]]"
data-provider="{{pkgList}}"
on-selection-checked="onSelectionChecked"
on-item-click="onDataCellClicked">
<cc-grid-toolbar title-text="Package정보" on-item-count-changed="onItemCountChanged">
<sc-button text="선택" on-click="onSelection"></sc-button>
</cc-grid-toolbar>
onItemCountChanged : function(event)
{
var me = this;
var grid = event.currentTarget.scGrid;
var provider = grid.getDataProvider();
switch (grid.id)
{
case "pkgGridPanel" :
if (!me.gridBindingCompleted && grid.provider.rowCount() > 0)
{
me.gridBindingCompleted = true;
// 자동선택
if (UT.isNotEmpty(me.searchParam.pack_no))
{
var rowIndexes = provider.filterIndexes(function(data)
{
return data.pack_no == me.searchParam.pack_no;
});
if (UT.isNotEmpty(rowIndexes))
{
grid.setCurrentCell({dataField:"pack_nm", rowIndex:rowIndexes[0]});
var _item = grid.getCurrentCell();
var _data = provider.getItemAt(_item.rowIndex);
grid.fire("item-click", {data:_data, item:_item, provider:provider});
}
}
}
if (grid.provider.rowCount() == 0)
{
me.gridBindingCompleted = false;
}
break;
}
}