Author Topic: New Record  (Read 2854 times)

omerix

  • Pro Enterprise
  • Full Member
  • *
  • Posts: 148
    • View Profile
New Record
« on: November 10, 2017, 01:00:07 pm »
I'm entering a new record. ID and other columns are turning empty.

New Record Video:
https://www.youtube.com/watch?v=DexaoYyHuAk


paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6296
    • View Profile
Re: New Record
« Reply #1 on: November 10, 2017, 09:52:27 pm »
It says "Video is unavailable".

omerix

  • Pro Enterprise
  • Full Member
  • *
  • Posts: 148
    • View Profile
Re: New Record
« Reply #2 on: November 10, 2017, 11:22:57 pm »
Hello,

I gave everyone access.

https://youtu.be/DexaoYyHuAk


paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6296
    • View Profile
Re: New Record
« Reply #3 on: November 10, 2017, 11:32:26 pm »
addList sent back by server is supposed to contain same values as the posted addList with the exception of record Id.

omerix

  • Pro Enterprise
  • Full Member
  • *
  • Posts: 148
    • View Profile
Re: New Record
« Reply #4 on: November 11, 2017, 01:40:11 am »
addList sent back by server is supposed to contain same values as the posted addList with the exception of record Id.

It worked like this.

But I want to show the values recorded in other columns. For this add  "grid.refreshDataAndView ();" after the line "grid.commit ({type: 'add', rows: changes.addList} I added the line.

There seems to be no other way.

omerix

  • Pro Enterprise
  • Full Member
  • *
  • Posts: 148
    • View Profile
Re: New Record
« Reply #5 on: November 11, 2017, 04:18:39 am »
I think I solved it.  ;D

I do not know if there is a shorter way.
rd['ID']=response.addList[index].ID;

Code: [Select]
success: function (response) {
/*
$.each(response.updateList,function(index, value){
console.log('update'+index);
$.each(value,function(index, value) {
console.log(index+'/'+value);
});
});
*/
var ri; //rowIndex
var rd; //rowData
var postChanges = grid.getChanges();

$.each(postChanges.addList,function(index, value){
ri=value.pq_ri;
console.log('ADD/rowIndex='+ri+',Changes Tinyint='+value.TINYINT+',Response Tinyint='+response.addList[index].TINYINT);
grid.addClass({rowIndx: ri, cls: 'pq-striped-error'});
rd = grid.getRowData({rowIndx: ri});
rd['ID']=response.addList[index].ID;
rd['TINYINT'] = response.addList[index].TINYINT;
grid.refreshRow({rowIndx:ri});
})


$.each(postChanges.updateList,function(index, value){
ri=value.pq_ri;
console.log('UPDATE/rowIndex='+ri+',Changes Tinyint='+value.TINYINT+',Response Tinyint='+response.updateList[index].TINYINT);
grid.addClass({rowIndx: ri, cls: 'pq-striped-error'});
rd = grid.getRowData({rowIndx: ri});
rd['TINYINT'] = response.updateList[index].TINYINT;
grid.refreshRow({rowIndx:ri});
})

grid.commit({ type: 'add', rows: response.addList });
grid.commit({ type: 'update', rows: response.updateList });
grid.commit({ type: 'delete', rows: response.deleteList });
grid.history({ method: 'reset' });
},

addList sent back by server is supposed to contain same values as the posted addList with the exception of record Id.