ExtJS4 : Rowediting - extjs

Currently I have some columns in my Grid, which are given a value on the server. (update_datetime for instance).
When I update a row on the client, the columns which are assigned a value on the server are not updated (they remain as is).
Is there a way (which does not require a reload of the entire store) to incorporate the changes ?
The result from the server does give back all the latest column details.
--I'm a bit new to extjs, so I think it's a pretty basic question.

You will need to sync the store with server with StoreWriter.
This link might be useful to you -
Updating database with Ext Store Writer - ExtJS 4.2

Related

Entity Framework Core not updating models after a SQL Server trigger updates and a new query of the database

I have an issue with a model not updating to the latest version after requiring the database (probably due to change tracking?).
I add the model to the dbset and save it through the context. At this point there is a server side trigger that updates a field with a link to another table pk column.
After adding the record i need to know the value in the updated column. I requery the database, and a SQL Server trace shows that the new value is returned, but the model value is not updated.
I have tried dethatching the entities similar to this answer. but this does not work.
I have worked around it by creating a new scope from the service scope factory and creating a second instance of my context, but would like to know why this happens and how to avoid it (I have no control of the database so I can't remove the trigger and do everything in code sadly).
Thanks
Paul
Ivans answer in the comments takes care of this. anotating the property in the model with [DatabaseGenerated(DatabaseGeneratedOption.Computed)]
takes care of everything atuomatically.
Thanks for the help

Excel like copy paste feature for adding data into grid using react and grid library

I am creating a kind of excel online application using react in frontend, Java in backend and Postgres database.I am using a library called ag-grid (community edition).
Now one of the feature i need is to copy and paste data in to rows
just as we do in excel.
The grid is going to be linked with the Postgres, all the data in the table in the DB is displayed into the grid and any change made into the grid will be reflected to the DB and vice-versa.
The specific need is, i need copy and paste feature, i need to paste the data which is, say copied from other excel in to my application. I should be able to create blank rows and i should be able to paste the data into those rows, if the blanks rows are less then it rows should get automatically added(as in excel) as soon as data (say multiple rows data) is pasted into a one or more rows.And when i choose to save the my application then data of grid should be saved to DB.
Is it possible to create this feature using ag-grid community ?
Is there any other library which is recommended for this purpose ?
If there is any resource or documentation available for this feature
then please point me.
Just in case if anyone stumbles upon this problem, I've found a solution from some another website. It uses processDataFromClipboard event of Ag Grid for a custom solution.
https://plnkr.co/edit/lM3OtCQxpJdapHQt?preview
The ag-grid community edition does not support CRUD operations with a server side model - the enterprise edition does:
https://www.ag-grid.com/javascript-grid-server-side-model-crud/
If you insist on using ag-grid community you will need to handle the editing/grid changes yourself, which should not be too hard. A good starting point would be the cell editing page:
https://www.ag-grid.com/javascript-grid-cell-editing/
In particular, you will need to listen to the cellValueChanged or rowValueChenged event:
https://www.ag-grid.com/javascript-grid-cell-editing/#event-cell-value-changed
The event params will provide you with the following properties:
newCalue
oldValue
column
colDef
which you can use to generate the update call.

How to setup EXTJS4 store for CRUD Couch DB?

How to calibrate Extjs 4 store for simple CRUD from/to couchDb?
There is a demo project that was put together for our last Austin Sencha meetup that shows connecting Ext 4 to both Couch and MongoDB:
https://github.com/coreybutler/JSAppStack
Specifically this class will probably help you get started.
I have developed a library called SenchaCouch to make it easy to use CouchDB as the sole server for hosting both application code and data. Check it out at https://github.com/srfarley/sencha-couch.
I'd like to point out that to fully implement CRUD capabilities with the demo require some modification. CouchDB requires you to append revisions for any update/delete operation. This can also cause some issues with the field attributes in the Ext REST proxy. There is a project called mvcCouch that would be worth taking a look at. This project references a plugin that should help with full CRUD operations against CouchDB.
You'll find a number of subtleties in ExtJS 4's REST proxy that can slow you down. this brief post summarises the major ones:
In your Model class, you have to either define a hardcoded 'id' property or use 'idProperty' to specify one column as 'id'.
You server side code needs to return the entire updated record(s) to the browser. CouchDB normally returns only an _id and _rev, so you'll have to find a way to get the entire document on your own.
Be aware that the format of the record in the "data" must be JSON-formatted.
Be sure to implemented at least one Validator in your Model class because, in ExtJS source code AbstractStore.js, you can find the following code, which may always return true for a new created record in RowEditing plugin when the store is set as autoSync = true.
filterNew: function(item) {
// only want phantom records that are valid
return item.phantom === true && item.isValid();
},
This last item is, in my opinion, a design bug. The isValid() function should by rights return true by default, and rely on the developer to throw an error if problems occur.
The end result is that unless you have a validator for every field, the updates never get sent to CouchDB. You won't see any error thrown, it will just do nothing.
I just released two update libs for Sencha Touch and CouchDB respecively(based on S. Farley's previous work). They support nested data writing and basic CRUD.
https://github.com/rwilliams/sencha-couchdb-extjs
https://github.com/rwilliams/sencha-couchdb-touch

extjs grid update on database change

I need info about updating grid when database is changed.
What I have:
A client application in php which uses Extjs to provide interface to db.
What seems to be a problem:
A problem occurs when for example there are two users are using the app. The 1st user changes and commits data to db, the 2nd user isn't able to see the changed data.
Other example is when admin changes data directly in db.
What I'm trying to do:
I need to be able to load changed data to the grid in timely maner. Reloading store is an issue because the data returned is huge (takes few seconds to load) and while the app would be used by hundreds of users at one time it would create quite an overhead.
Can I load only changed rows (can be checked by timestamp)?
There are 2 parts I see in this question:
Q) Can you update only the changed rows?
A) Sure. Find the record (using the store's "find" function), change the appropriate values (using record.set(key, value)) and commit the changes.
Q) Can you synchronize multiple users?
A) You have 2 options. Option #1, you can lock the object so only one user can edit at a time. This is the simplest solution. Option #2, you can add a synchronizing option (via comet would probably be the best option) and synchronize the changes as they occur.

WPF live Update from database

I am building a multiuser WPF application (requirement is a desktop app), database SQL Server 2008.
There are two types of users.
The first type user will enter a record which would be stored in a table.
The second type user initially will be presented with a listbox with the records from the table. The requirement is that the listbox must be updated live (i.e. if a new record is entered by the first user the listbox must be updated).
Currently I have not yet implemented the Database functionality.
I am currently working with ObservableCollection and simulating this scenario.
I would like to know the best approach for achieving this.
Should i use a timer and keep querying the table? Is there a more efficient way?
Is this even possible (should I switch to ASP.NET?) ?
I would appreciate any suggestions and tips that you may have.
Try using SqlDependency, since it can raise an event (OnChange) in your code when the results of a query would change on the server (as the result of an INSERT or UPDATE from another user or process, for example)
An example of its use on CodeProject for a simple live chat application:
http://www.codeproject.com/KB/database/chatter.aspx

Resources