Copying content into clipboard is a security hole. As a result no simple javascript method is available to write content into clipboard. Except IE, no other browser supports this without any plugins/flash. But if you just want to copy one row of grid and paste it into another grid you can use following hack.(Two grid stores should use same model).
- Select a row and provice ExtJS context menu, in action get selected record. It will be in the form of model. Convert this model object into JSON object using getData(true) method on the model. It converts model object into json including association data.
- Now your task is to persist this data in user's environment. For this you can use HTML5 web storage. It is simple, faster and secure. But it doesn't work on IE7 and earlier versions.
localStorage.setItem("json-object", model.getData(true));
- Above code stores model object into client's browser in the form of string.
- When you wan to handle paste, fetch the stored data string and decode into JSON object.
var jsonObject = Ext.Deode(localStorage.getItem("json-object"));
- After retrieving jsonObject convert this back in to model and push it into grid's store.
Check
this to convert jsonObject into model.
No comments:
Post a Comment