var data = [
{ itv_seq: 1, pro_cod: 1723, pro_descr: 'Exxon Mobil', itv_status: 1, itv_preco: 339938.5, itv_quant: 12, itv_peso: 2, itv_total: 36130.07, itv_descr: '' }
];
var calcula_preco_total = function (ui) {
var rd = ui.rowData;
return rd.itv_preco * rd.itv_quant;
}
var obj = {
width: "100%",
flexHeight: true,
pageModel: { type: "local", rPP: 20, strRpp: "{0}", strDisplay: "{0} to {1} of {2}" },
freezeCols: 2,
showTitle: true,
title: "",
collapsible: false,
numberCell: false,
editModel: { onTab: 'nextEdit' },
cellSave: function (evt, ui) {
this.refreshRow(ui);
},
toolbar: {
items: [
{
type: 'button', icon: 'ui-icon-plus', label: 'Adicionar', listeners: [
{
"click": function (evt, ui) {
var rowData = { itv_seq: 2 };
var rowIndx = grid.addRow({ rowData: rowData, checkEditable: false });
grid.goToPage({ rowIndx: rowIndx });
grid.editFirstCellInRow({ rowIndx: rowIndx });
}
}
]
}
]
},
colModel: [
{ title: "Sequencia", dataType: "integer", width: 100, dataIndx: "itv_seq", editable: false, align: "center" },
{ title: "Cód Produto", dataType: "string", width: 250, dataIndx: "pro_cod", align: "center" },
{ title: "Descr Produto", dataType: "string", width: 250, dataIndx: "pro_descr", align: "center" },
{ title: "Status", dataType: "integer", width: 200, dataIndx: "itv_status", align: "center" },
{ title: "Preço Unitário", dataType: "float", format: "##.###,00", width: 150, dataIndx: "itv_preco", align: "center" },
{ title: "Quantidade", dataType: "float", format: "##,000", width: 150, dataIndx: "itv_quant", align: "center" },
{ title: "Peso", dataType: "float", format: "##,00000", width: 150, dataIndx: "itv_peso", align: "center" },
{ title: "Preço Total", dataType: "float", format: "R$ ##.###,00", width: 150, dataIndx: "itv_total", editable: false, formula: calcula_preco_total, align: "center" },
{ title: "Descrição Complementar", dataType: "string", width: 300, dataIndx: "itv_descr", align: "center" }
],
dataModel: { data: data }
};
var grid = pq.grid("#grid_produto", obj);
Why when you add a new line to focus in the first editable column loses focus