jQWidgets Forums
Forum Replies Created
-
Author
-
November 28, 2014 at 3:51 pm in reply to: jqxInput / Autocomplete not sync with source after change jqxInput / Autocomplete not sync with source after change #63526
What if I want to extends this behaviour, do I have access to some sort of a “selected object” that I could reset myself?
November 19, 2014 at 7:52 pm in reply to: DataTable usage / synchro DataTable usage / synchro #63031Finally got something done.
calling $.extend(data, updatedData) did what I needed.
November 19, 2014 at 6:40 pm in reply to: DataTable usage / synchro DataTable usage / synchro #63029It’s exactly what I do, thing is in the following sample:
CREATE TABLE IF NOT EXISTS [CUSTOMER] ( [id] INTEGER PRIMARY KEY AUTOINCREMENT, [licence_number] BLOB NOT NULL UNIQUE, [name] VARCHAR(2) NOT NULL, [language] VARCHAR(2) DEFAULT ('en'), [creation_date] DATETIME DEFAULT (DATETIME('now')) );
Note that id and creation date are automatically generated
Once I’ve called addrow() on the grid with the customized form, it gets the language, name and licence number from the user, then the datasource addrow() is called. From this point, the data is inserted into the database, no mater how, it gets back with an updated id and created_date. I am still in the datasource addrow() callback. What do I do with my updated data? (id, creation date) How can I pass it in the datasource’s data so it gets it? Later, in the screen, a getRow() will be called from the grid, and then, all its data is required.
If the datasource corresponding entry is not updated, the grid knows only about the licence number, name and language, not the id and creation date.
November 19, 2014 at 4:59 pm in reply to: DataTable usage / synchro DataTable usage / synchro #63026Still not clear to me what I should do.
var source = { localdata: [], datatype: "array", datafields:[ {name: 'id', type: 'integer'}, {name: 'code', type: 'string'}, {name: 'client_code', type: 'string'}, {name: 'system', type: 'string'}, {name: 'bay', type: 'string'}, {name: 'section', type: 'string'}, {name: 'creation_date', type: 'string'}, {name: 'client_id', type: 'string'}, {name: 'priority', type: 'string'}, {name: 'status', type: 'string'} ], id: "id", addrow: function (rowId, data, position, commit) { createInDatabase(data, function(updatedData){ commit(true); // Need to update with updatedData.createdDate and not displayed in the grid (columns) but known by the datafields. }); }, deleterow: function (rowid, commit) { // NOT YET }, updaterow: function (rowId, data, commit) { // NOT YET } }; var gridDataAdapter = new $.jqx.dataAdapter(source);
Once commit() has been called, where is the “new row”? Since the object comming back from the success callback from the database is not the same, how do I fill the new data in? What if I want to propagate the whole new objects, that contains more than just the created date without refreshing the entire grid?
I get that I can call updateBoundData(), but this data is not yet in the grid, and what if this new row wouldn’t be shown, because of the sort / filter / paging?
Calling setCellValue() doesn’t seem to be an option to me, since I want to update the datasource “full” row / object
Wouldn’t be simpler to make a call to commit with the actual “refreshed” data?
I just found out about this post.
So I changed to use the jqxGrid instead. Just a comment, but this is confusing… jqxDataTable documentation shows lots of functionality event for a complex solution…
Anyway, the documentation suggests to refresh the grid when data changes, do I really want to refresh the whole thing even if the rowId is known in the addRow and updateRow?
-
AuthorPosts