iSeller Commerce
iSeller POS Retail
iSeller POS F&B
iSeller POS Express
Crosslight
WebUI
ClientUI
What's New
Download Trial
Web Solution
Mobile Solution
Enterprise Solution
Custom Development
Blog
Community
Latest Development Blogs
ForumPostTopic
Browse By Tag
Nice solution, stupid I didn't realise this was an option too. Thanks!!
Hi Glenn,
It actually concerns sample BatchUpdate1.aspx in the attached Batch.zip.
In your scenario, which event handler are you using in an attempt to cancel the row addition? In your scenario, does the message occur after each pending changes or after accept all changes occurs?
Let me describe the situation a little more. The webgrid is currently used in combination with a search box. The selected results (can be more than one), will be added to the 'container'/'selected results' webgrid. However, all results and record values will be added on clientside.
Because of clientside addition (user can't interact at this point), no eventhandler of the webgrid is used. The records will be added if the user makes the selection of search results final. So for me, this is a logical place to check the record already exists (correct me if I'm wrong).
If no check is applied or the check fails (as descriped in topic start), the WebGrid displays the message on the line where I call AddPendingChanges(). The message is: The pending changes already contain a record with key 'x'.
I hope this clearifies the situation and hope you'll have an idea of how to solve this problem.
Thanks in advance!
Hi Andi Santoso,
Thanks for your reply and clearifying example. It was indeed what I was looking for. The 'window.' prefix is a nice example for my case. I couldn't find any of that in the examples, but just this one explains it all.
Thanks and I wish you a nice day too!
Regards,
Herman Cordes
Yudi,
Thanks for the clarifying response! That explains it all.
I've a workaround in mind by wrapping or modifying my object model, so that sub properties will read as a String. Maybe you've encountered more of template column requests for client binding with a more decent solution? (Not so important question, but maybe you or someone has a nice solution.)
Thanks again!
Herman
Just one more thing. I'm now at the stage whereby I need to add some templated databound columns to the above example. With other, not clientbinding grids, templated columns works as designed, however with clientbinding it returns a javascript error:
line 8char 38880"'null' is null or not an object"
My column definition is as follows:
<ISWebGrid:WebGridColumn Caption="Test" DataMember="UserName" ColumnType="Template" Width="100px"> <CellTemplate> <asp:Label ID="Label7" runat="server" Text='Test' /> </CellTemplate> </ISWebGrid:WebGridColumn>
Currently just for test, but it simple doesn't work with 'DataMember' assigned. If I leave that empty, it works, but unfortunatly I do need the data.
My last try was defined like this:
<ISWebGrid:WebGridColumn Caption="Test" ColumnType="Template" Width="100px"> <CellTemplate> <asp:Label ID="Label7" runat="server" Text='<%# Test() %>' /> </CellTemplate> </ISWebGrid:WebGridColumn>
It calls a server side method to calculate some text, but unfortunatly it doesn't call the method (by debugging it's not stepping into at least).
So I'm a little bit lost about what to do and how to get some custom data in it. I'd like to display a subproperty from the dataobject (Department.Code), which is not possible to do without a TemplatedColumn I believe.
Anyone got an idea? Thanks in advance.
Just thinking about one little addition to this question.
Because the client bound grid is used as part of a search page, the grid shouldn't be filled when the page opens. This is, however, the case at the moment because DataSourceID is set already.
Is it someway, somehow possible to perform databinding just the same way as in the sample, but with an empty grid on page load?
Thanks.
Perfect solution, thanks for the clear sample. Very quick sample too!
Hi again,
Searched the forum and support forum, but can't really understand what you mean by delay/timeout... Is there a specific method for defined?
Along the way searching I tried the following, which unfortunately also had no effect:
for(var i = 0; i < this.grid.RootTable.GetRowsCount(); i++) { grid.RootTable.GetRow(i).Select(); grid.RootTable.GetRow(i).SetDeleted(); } grid.RootTable.UpdateUI(); grid.UpdateState();
This will select the row and use SetDeleted() of the row object instead of Delete(). Also does it call UpdateState() afterwards... The only visual effect is that the last row of this selection is selected. But unfortunatly no rows will be deleted...
Just a thought: does it have something to do with the fact that it isn't possible to delete a pending row change? Because of the batchupdate settings... which, however, are not used, but added to make it work from clientside without server postbacks.
Hope someone can give me the answer that will delete all rows in the WebGrid from clientside... Thanks in advance.
Hi Handy,
Thanks again for a reply. I'll have a look what you mean by delay/timeout. For the moment, answers to your questions:
No I don't use clientbinding. From an AJAX response call to search my database, I fill the grid with the results as follows:
function searchCompleted(result) { var grid = ISGetObject("SearchResultsWebGrid"); if(result != null) { for(var i = 0; i < result.length; i++) { var newRow = grid.RootTable.NewRow(); newRow.KeyValue = result[i][0]; var cells = newRow.GetCells(); cells.GetNamedItem("UserName").SetText(result[i][1], true); cells.GetNamedItem("FullName").SetText(result[i][2], true); cells.GetNamedItem("PhoneNumber").SetText(result[i][3], true); cells.GetNamedItem("MobilePhoneNumber").SetText(result[i][4], true); cells.GetNamedItem("EmailAddress").SetText(result[i][5], true); cells.GetNamedItem("Department").SetText(result[i][6], true); newRow.AddPendingChanges(); } } }
My grid definition:
<ISWebGrid:WebGrid ID="SearchResultsWebGrid" runat="server" Width="100%" Height="493px" UseDefaultStyle="True" DefaultStyleMode="Win7"> <LayoutSettings AllowBatchUpdate="True" AllowAddNew="Yes" AllowEdit="No" AllowDelete="Yes" AllowContextMenu="false"> <ClientSideEvents OnAfterInitialize="WebGrid_HideInsertRow" /> <BatchUpdateSettings HighlightChanges="false" PromptUnsavedChanges="false" AllowReviewChanges="false" AllowUndoChanges="false" /> <StatusBarStyle CssClass="general_invisible" /> <TextSettings> <TextItems> <ISWebGrid:WebGridTextItem TextItem="CommonText/NoData" TextValue=" " /> </TextItems> </TextSettings> <FrameStyle CssClass="gridmodal" /> </LayoutSettings> <RootTable ColumnHeaders="Yes" DataKeyField="MessageId"> <Columns> <ISWebGrid:WebGridColumn Caption="Username" DataMember="UserName" Name="UserName" Width="90px" /> <ISWebGrid:WebGridColumn Caption="Name" DataMember="FullName" Name="FullName" Width="150px" /> <ISWebGrid:WebGridColumn Caption="Phone" DataMember="PhoneNumber" Name="PhoneNumber" Width="80px" /> <ISWebGrid:WebGridColumn Caption="Mobile phone" DataMember="MobilePhoneNumber" Name="MobilePhoneNumber" Width="100px" /> <ISWebGrid:WebGridColumn Caption="E-mail" DataMember="EmailAddress" Name="EmailAddress" Width="130px" /> <ISWebGrid:WebGridColumn Caption="Department" DataMember="Department" Name="Department" Width="70px" /> </Columns> </RootTable></ISWebGrid:WebGrid>
Logical and of course I agree. But I found it somewhat strange, because the possibility is given to request unmodified rows.
Thanks for the clarification though.
or
Choose this if you're already a member of Intersoft Community Forum. You can link your OpenID account to your existing Intersoft Social ID.
Choose this if you don't have an Intersoft account yet. Your authenticated OpenID will be automatically linked to your new Intersoft account.
Enter your Wordpress Blogname