Can anyone tell me how to connect my dojo datagrid to "onApplyCellEdit" event and how to update the dojo store with the updated values in the grid. thanks.
if youre using a store which implements dojo.data.api.Write (like ItemFileWriteStore or such), then your store will handle this by default, once it is connected to a datagrid.
When youre done editing (or do it on cell.onblur or like) check if any changes was made to store by calling store.isDirty(). If it returns true, either a new, modified or deleted item is not in sync with server.
To sync, look into the api.Write and see that for every store there is a call .save() - which ofc you must implement (unless you leverage REST with PUT/DELETE/POST pattern)
Related
I am trying to make an input field which accepts text and image with copy/paste feature. I am looking for a way to save the contains of this field and then retrieve and display the same in non-editable field.
Can this be done with dijit.editor?
I appreciate any tip on this. Thank you.
You will need more than just digit.Editor.
You will need at least something like:
digit/Editor for the writable UI
div for the readonly UI
dojo/request for sending Editor value to backend and for getting saved value from the DB
A server able to handle non static pages (like Apache + php)
A database (like mysql)
A backend API to save and read from the database
I'm transitioning a corporate web page into a new xpage platform. It consists of a number of department-specific databases each with their separate ACL's with the old forms and docs, and one new xpage db front end presenting data from across the other db's read only. The content is regulations and resources for the rest of the organization to relate to.
The design consists of just a few custom controls which collects data sources dynamically via properties on the various department specific xpages. So like 30 xpages collecting data from separate db's utilizing the same handful of cc's
My scoped variable issue is related to my cc_dataViewLocal . This dataView presents the documents from the corresponding views in the source db's. To let the user know their present location in the application I pull in the name of the current view and display the name above the Data View as a headline on the DataView xpage:
<xp:text escape="true" id="computedField1" styleClass="ksHeading2">
<xp:this.value><![CDATA[#{javascript:getComponent("dataView1").getData ().getView()
}]]></xp:this.value>
</xp:text>
All documents from all databases are presented using the same documentDisplay xpage with a dynamic document data source. Thus this xpage does not have any properties but is referenced trough the data view xpage:
<xe:dataView id="dataView1" collapsibleCategory="false"
rows="50" style="font-size:8pt" rowStyle="font-size:8pt"
collapsibleDetail="true" pageName="/**ks_documentDisplay.xsp**"
var="rowHandle">
--
When I open a document from the data view in documentDisplay.xsp I want the same headline/name of the original view displayed there as well. To make that happen I try to catch the view name in a scoped variable in an afterPageLoad event in the data view xpage, to redisplay it on the documentDisplay xpage.
<xp:this.afterPageLoad>
<xp:setValue binding="#{sessionScope.ksView}">
<xp:this.value><![CDATA[#{javascript:getComponent
("computedField1").value}]] ></xp:this.value>
</xp:setValue>
</xp:this.afterPageLoad>
After all the view name is not part of the document data source, and I have no other handle to the parent view at this point as I can see.
--
When I display the scoped variable on the dataView xpage in a computed field it works fine:
<xp:text escape="true" id="computedField2"
styleClass="ksHeading1" value="#{sessionScope.ksView}">
However, when I try to display the same session variable in the documentDispay xpage using the same computed field coding it turns up empty. Like the sessionVariable is lost to the next xpage?
I started out with a viewScope, and tried both request and session with same results. What am I missing??
Any input greatly appreciated! Including workarounds but would like to get a grip on the scoped variables...:-)
Regards to all who read this somewhat long post and thanks in advance!
Vidar Solevag
Thanks again for pointing me in the right direction. The problem clearly was I wiped the sessionScope in some way or other, exactly how I still don't know.
But as often is the case the solution was to do something else to get the same thing done...
What I found not to work:
-Moving the event to onClientLoad didn't work it threw an exception "cannot handle". In addition my original approach afterPageLoad did't really work either as it didn't update properly as other dataViews were chosen via Navigator on the page. Also setting the variable via the "Set" option on the simpleAction list turned out to be a problem. I got several "Not allowed to set the value of a read only computed expression"
What I did that worked:
-I set the value not by "Set"Simple action but by "Excecute script" and code
sessionScope.ksView=context.getSubmittedValue(). This in the onClick event in Navigator that selects which Dataview to display On the DataView xpage Then the SessionScope remains alive all the way into the documentDisplay xpage and until a different Dataview is selected back in the Nav back on the DataView xpage.
Now using the same sessionScope as the viewName property on the xpage I also set the sessionScope initially on afterPageLoad to have a default value when page is first opened...
So thanks again, a lot of headbanging into the wall here but that's what you learn from I guess :-))
I want to check if data is loaded in grid. Now I use Property Checkpoint->Content Text, but my data is invariable.If my data is changeable, how I can check data is loaded or not?
You can validate the property of the grid control that is telling how many items the grid contains. This will make you be able to validate that there are the correct number of items or at least one record exists in the grid.
Also, you can create a script function that will read data from the grid control using its native methods and properties and validate data within this function as you need.
I have a core data 'ShoppingList' which contains 'Item' objects. I store a display order as an attribute of each item.
I would like to update the display order of all other items in the shopping list whenever an item is deleted. The code to do this is working fine when I use it in my view controller (from where the item is deleted), but since it is really related to the business objects and not the view, it would be better placed in either ShoppingList or Item.
Ideally, I would like it incorporated into the deletion of the item. So far I have tried the following:
1) Customize the standard Core Data generated ShoppingList.RemoveItemsObject (making sure to observe KVO before.after). What's strange about this way is that the item passed is stripped of its relationships to other core data entities before it gets to my code, which I need to process display orders correctly.
2) Customize Item.didTurnIntoFault. Same applies - but even attributes of the item are gone by this stage.
One answer would be to simply define a new method on ShoppingList that does my processing and then calls the original removeItemsObject. But I would prefer to know that whenever an item is removed, from anywhere, this is taken care of. This works nicely when I customize awakeFromInsert, for example - I know that whenever an item is created certain things are setup for me. But I'm surprised there's no equivalent for deletion.
Did you try to implement prepareForDeletion? Sounds like it's exactly what you're looking for.
The doc says:
You can implement this method to perform any operations required before the object is deleted, such as custom propagation before relationships are torn down, or reconfiguration of objects using key-value observing.
I have JQGrid loading data from WCF OperationContract with paging and sorting working fine. I am using "multiselect: true" so that I get the checkbox column and ability to select multiple rows. I've implemented gridComplete:, onSelectAll: and onSelectRow: to capture when checkboxes are checked/unchecked and to maintain checked state upon pagination. I am able to save the checkbox state to the DB via another WCF method call.
What I cannot figure out how to do is load the saved checkbox state for each row along with the other fields specified in colModel:.
Any ideas? I realize I can make a separate WCF service call to get the values, loop through them and set state manually, but that seems like a huge waste and overly clunky.
Thanks in advance.
The simplest way, which I imagine me immediately after reading of your question, is to have additional hidden column (hidden: true property in the colModel for the column) and the checkboxes inside. You can load the selection state from the database an fill the hidden checkboxes. Inside of loadComplete or gridComplete you can use the information to select the rows.
If you would use loadComplete instead of gridComplete you can even eliminate the need to hold hidden row. The callback method loadComplete has data parameter which are initialized with the data originated from the ajax call. So if your server response contain more information as jqGrid need the data will be ignored by jqGrid, but you can see the data in the loadComplete and use the information to set row selection.