I’ve been looking around in the documentation an the forum, but didn’t find an answer to my question.
How can I insert a row in dhtmlx.grid where the Id field is managed by the database (postgres serial or mysql autoincrement). The example in the documentation uses a kind of timestamp to create an unique id, which is elegant, but doesn’t fit to my needs.
function addRow(){
var newId = (new Date()).valueOf()
mygrid.addRow(newId,"",mygrid.getRowsNum())
mygrid.selectRow(mygrid.getRowIndex(newId),false,false,true);
}
Is there an other standard way of inserting new rows to the database table using an autoincremented Id-field that is managed by the database?
As newbie to dhtmlx I would really apreciate any advice.
Georges
This approach does not work for me, since the autoincremented id is not similar to the number of datasets. Even if one would check the highest value in the table it could be that the last entries where deleted, so that they doesn’t reflect the state of the autoincremented id.
Isn’t it possible to add a new empty row, that is then filled with data?
I wonder how all the other poeple work with dhtmlgrid and databases with autoincremented fields.
I can’t believe, that the mentioned example with a timestamp is the only workaround.
I agree with geom, a final solution for this issue is essential, especially if we consider the possibility of having concurrent access from multiple users
I wonder if there is something new about this in the current/upcoming version
Br,
dp.attachEvent("onAfterUpdate", function(sid, action, tid, tag) {
if (action == "inserted")
{
alert(tid)
// where tid= the new insered id (on Server)
}
}
can anyone please tell me. how to add S.NO to grid.
there is no serial number field in the grid. could you clarify your issue.
in preview post what is ‘mygrid’… if it is ID of grid means, where i have to assign it.
When you create a dhtmlxgrid object you define it’s name:
mygrid = new dhtmlXGridObject(‘gridbox’);
if i use mygrid.getRowsNum() means it showing undefined is not a function
Unfortunately the issue cannot be reproduced locally.
If the problems still occurs for you please, provide with any kind of sample of your code or with a complete demo, where the issue can be reconstructed locally.
Here you can find a tutorial about creating a demo: docs.dhtmlx.com/auxiliary_docs__ … pport.html
in grid view i am showing how many schedules are there, so i need row number(S.No) for each row just like below…
My GRID:
Event StartDate EndDate
Task1 Nov 9 Nov 10
Task2 Nov 19 Nov 20
Task3 Nov 29 Nov 29
Task5 Nov 30 Nov 30
I WANT LIKE THIS:
S.NO Event StartDate EndDate
1 Task1 Nov 9 Nov 10
2 Task2 Nov 19 Nov 20
3 Task3 Nov 29 Nov 29
4 Task5 Nov 30 Nov 30
TOTAL Schedule - 4
in sample link source, there are using
mygrid = new dhtmlXGridObject(‘gridbox’);
mygrid.splitAt(1);
to create gridView and Counter…
but iam using scheduler.createGridView({ }); method to create grid tab (in scheduler events)…
now please suggest me where i have to use mygrid.splitAt(1); method
This is the forum about the dhtmlxGrid component.
If you have some issues about the dhtmlxScheduler you may try to ask it in the proper topic: viewforum.php?f=6
Get a guaranteed answer from DHTMLX technical support team
under the most suitable support plan