81 lines
2.6 KiB
JavaScript
81 lines
2.6 KiB
JavaScript
|
|
function InitializeTableCost() {
|
||
|
|
// Initialize appendGrid
|
||
|
|
$('#tableCostEdit').appendGrid({
|
||
|
|
hideRowNumColumn: false,
|
||
|
|
caption: null,
|
||
|
|
initRows: 1,
|
||
|
|
columns: [
|
||
|
|
{
|
||
|
|
name: 'name',
|
||
|
|
type: 'text',
|
||
|
|
ctrlClass: 'inputs',
|
||
|
|
display: SUGAR.language.get("app_strings", "LBL_NAME"),
|
||
|
|
displayCss: {'vertical-align': 'middle'},
|
||
|
|
ctrlCss: {'text-align': 'right'},
|
||
|
|
},{
|
||
|
|
name: 'koszt',
|
||
|
|
display: SUGAR.language.get("app_strings", "LBL_COST"),
|
||
|
|
type: 'text',
|
||
|
|
ctrlClass: 'inputs',
|
||
|
|
displayCss: {'vertical-align': 'middle'},
|
||
|
|
ctrlCss: {'text-align': 'right'},
|
||
|
|
onChange: function (evt, rowIndex) {
|
||
|
|
// formatowanie
|
||
|
|
var data = $('#tableCostEdit').appendGrid('getRowValue', rowIndex);
|
||
|
|
if (data.koszt != '') {
|
||
|
|
$('#tableCostEdit').appendGrid('setCtrlValue', 'koszt', rowIndex, FormatNumber(data.koszt));
|
||
|
|
}
|
||
|
|
},
|
||
|
|
},{
|
||
|
|
name: 'addcolumn',
|
||
|
|
display: 'addcolumn',
|
||
|
|
ctrlClass: 'inputs',
|
||
|
|
type: 'text',
|
||
|
|
displayCss: {'vertical-align': 'middle'},
|
||
|
|
ctrlCss: {'text-align': 'right'}
|
||
|
|
}
|
||
|
|
],
|
||
|
|
i18n: {
|
||
|
|
append: SUGAR.language.get("app_strings", "LBL_APPENDGRID_I18_APPEND"),
|
||
|
|
remove: SUGAR.language.get("app_strings", "LBL_APPENDGRID_I18_REMOVE"),
|
||
|
|
insert: SUGAR.language.get("app_strings", "LBL_APPENDGRID_I18_INSERT"),
|
||
|
|
moveUp: SUGAR.language.get("app_strings", "LBL_APPENDGRID_I18_MOVEUP"),
|
||
|
|
moveDown: SUGAR.language.get("app_strings", "LBL_APPENDGRID_I18_MOVEDOWN"),
|
||
|
|
removeLast: SUGAR.language.get("app_strings", "LBL_APPENDGRID_I18_REMOVELAST"),
|
||
|
|
rowEmpty: SUGAR.language.get("app_strings", "LBL_APPENDGRID_I18_ROWEMPTY"),
|
||
|
|
rowDrag: SUGAR.language.get("app_strings", "LBL_APPENDGRID_I18_ROWDRAG"),
|
||
|
|
},
|
||
|
|
customGridButtons: {
|
||
|
|
insert: function () {
|
||
|
|
var button = document.createElement('img');
|
||
|
|
button.src = 'modules/EcmQuotes/images/add_position.gif';
|
||
|
|
return button;
|
||
|
|
},
|
||
|
|
moveUp: function () {
|
||
|
|
var button = document.createElement('img');
|
||
|
|
button.src = 'modules/EcmQuotes/images/moverowup.gif';
|
||
|
|
return button;
|
||
|
|
},
|
||
|
|
moveDown: function () {
|
||
|
|
var button = document.createElement('img');
|
||
|
|
button.src = 'modules/EcmQuotes/images/moverowdown.gif';
|
||
|
|
return button;
|
||
|
|
},
|
||
|
|
removeLast: function () {
|
||
|
|
var button = document.createElement('img');
|
||
|
|
button.src = 'modules/EcmQuotes/images/deleterow.gif';
|
||
|
|
return button;
|
||
|
|
},
|
||
|
|
append: function () {
|
||
|
|
var button = document.createElement('img');
|
||
|
|
button.src = 'modules/EcmQuotes/images/insertrow.gif';
|
||
|
|
return button;
|
||
|
|
},
|
||
|
|
remove: function () {
|
||
|
|
var button = document.createElement('img');
|
||
|
|
button.src = 'modules/EcmQuotes/images/deleterow.gif';
|
||
|
|
return button;
|
||
|
|
},
|
||
|
|
},
|
||
|
|
});
|
||
|
|
}
|