PDA

View Full Version : [CLOSED] [4.2.1 beta] Model idgen makes all records modified



Daniil
26 Apr 2013, 5:57 AM
REQUIRED INFORMATION

Ext version tested:

Ext 4.2.1 beta
Browser versions tested against:

Chrome
IE9
DOCTYPE tested against:

<!DOCTYPE html>
Description:

Model idgen (seems, any) makes all records modified.
EDIT: Hmm, it looks logical that the records are dirty since idgen generates ids from them. In 4.1 they are no dirty. Maybe, you fixed it:) I would appreciate any comments.
Steps to reproduce the problem:

Click the button
The result that was expected:

No modified records
The result that occurs instead:

All the records are modified
Test Case:


<!DOCTYPE html>
<html>
<head>
<title>Model idgen makes all records modified</title>

<link rel="stylesheet" href="../resources/css/ext-all.css" />

<script src="../ext-all-debug.js"></script>

<script>
Ext.onReady(function () {
Ext.define('MyModel', {
extend: 'Ext.data.Model',
idgen: 'sequential',
fields: [{
name: "test1"
}, {
name: "test2"
}, {
name: "test3"
}]
});

var grid = Ext.create("Ext.grid.Panel", {
renderTo: Ext.getBody(),
store: {
model: "MyModel",
data: [{
test1: "1",
test2: "2",
test3: "3"
},
{
test1: "4",
test2: "5",
test3: "6"
}, {
test1: "7",
test2: "8",
test3: "9"
}]
},
columns: [{
text: "Test1",
dataIndex: "test1"
}, {
text: "Test2",
dataIndex: "test2"
}, {
text: "Test3",
dataIndex: "test3"
}]
});

Ext.create("Ext.button.Button", {
renderTo: Ext.getBody(),
text: "store.getModifiedRecords()",
handler: function () {
alert(grid.getStore().getModifiedRecords());
}
});
});
</script>
</head>
<body>

</body>
</html>


*EDIT BY SLEMMON
Additional test case:



Ext.define('MyModel', { extend : 'Ext.data.Model', idgen : 'sequential', fields : [ { name : "test1" }, { name : "test2" }, { name : "test3" } ]});var record = new MyModel({ name : 'foo'});console.log(record);

slemmon
26 Apr 2013, 7:35 AM
Thanks for the report! I have opened a bug in our bug tracker.

Daniil
26 Apr 2013, 10:46 AM
Thank you, @slemmon.

Could you share your opinion on this statement? I am just not sure how it must be.

Description:


EDIT: Hmm, it looks logical that the records are dirty since idgen generates ids from them. In 4.1 they are no dirty. Maybe, you fixed it:) I would appreciate any comments.

incutonez
30 Jun 2014, 6:02 AM
This was never fixed in 4.2.1... hopefully it's fixed in 5.