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
hi,
i have one data table returned from webservice using flypostback manager. i have to add this data to webgrid. i used the below code, but it do insert only one row. but i check the return datatable has two rows.
function WebFlyPostBackManager3_Ongetdatafinished(returnValue) { var dt = returnValue; var grid = ISGetObject("WebGrid1"); var rowslength= dt.Rows.length; for(var i=0; i< rowslength; i++) { var newRow = grid.RootTable.NewRow(); var cells = newRow.GetCells() ; cells.GetNamedItem("SYSID").SetText(dt.Rows[i].Cells[0].Value, true); cells.GetNamedItem("ID").SetText(dt.Rows[i].Cells[1].Value, true); cells.GetNamedItem("REPORTNAME").SetText(dt.Rows[i].Cells[2].Value, true); cells.GetNamedItem("USER").SetText(dt.Rows[i].Cells[3].Value, true); cells.GetNamedItem("COMPANY").SetText(dt.Rows[i].Cells[4].Value, true); var tempdate= dt.Rows[i].Cells[5].Value; cells.GetNamedItem("REQUESTEDTIME").SetText(tempdate, true); cells.GetNamedItem("ELAPSEDTIME").SetText(dt.Rows[i].Cells[6].Value, true); cells.GetNamedItem("FORMAT").SetText(dt.Rows[i].Cells[7].Value, true); cells.GetNamedItem("REPORTFILENAME").SetText(dt.Rows[i].Cells[8].Value, true); cells.GetNamedItem("STATUS").SetText(dt.Rows[i].Cells[9].Value, true); cells.GetNamedItem("CRYSID").SetText(dt.Rows[i].Cells[10].Value, true); cells.GetNamedItem("VIEWED").SetText(dt.Rows[i].Cells[11].Value, true); newRow.Update(); alert("add row finished") } }
is there any way
thanks and regards
ca
Based on your description have you tried using the WebGrid refresh function in order to force the WebGrid refresh the data after you invoke all the update function.
Here is the updated snippet:
function AddGridRow(){ var grid = ISGetObject("wgTest"); var maxRow = 2; var i = 0; var updateProcess = setInterval(function () { if (!grid.IsInProgress && i < maxRow) { var newRow = grid.RootTable.NewRow(); var cells = newRow.GetCells(); //Add cell logic newRow.Update(); i++; } if (i >= maxRow) { clearInterval(updateProcess); updateProcess = null; grid.Refresh(); } }, 15);}
Another suggestion will be to update your WebGrid and WebUI Framework version to the latest version.
Based on my test, the issue seems to be caused by update function. This function will trigger an asynchronous call, so we will not br able to add another row while the grid is still processing.
Here is a workaround so multiple row could be added during client side event handler:
function AddGridRow(){ var grid = ISGetObject("wgTest"); var maxRow = 2; var i = 0; var updateProcess = setInterval(function () { if (!grid.IsInProgress && i < maxRow) { var newRow = grid.RootTable.NewRow(); var cells = newRow.GetCells(); //Add cell logic newRow.Update(); i++; } if (i >= maxRow) { clearInterval(updateProcess); updateProcess = null; } }, 15);}
thanks for your quick answer. It doesnt solve my problem. I applied the method you given above. Now also , after the execution of the javascript function, i am getting only one row. even i have more than one in the loop to add.
If i refresh the page after adding the rows, i am getting correct result by adding all the rows. Here i am using client side add to avoid refresh of the page. so page refresh is not my solution.
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