Author Topic: Add row with focus dont work  (Read 2636 times)

rdorazio

  • Newbie
  • *
  • Posts: 9
    • View Profile
Add row with focus dont work
« on: May 28, 2016, 07:09:40 am »
Code: [Select]
        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

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6210
    • View Profile
Re: Add row with focus dont work
« Reply #1 on: May 31, 2016, 07:18:11 pm »
When cell is being edited, editor gets focus. Cell and editor can't get focus simultaneously.