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
Does anyone know how to toggle the Add New Row box via the client side?
There is a show and a hide for GroupByBox and FilterBox but what about the Add box?
Hi Shawn,
Unfortunately, we do not have the API for that feature at this moment. However, we can get its element and set the display to none. Here is the snippet on how to do so.
This is to hide the AddNewRow:
function Button1_onclick(){ var grid = ISGetObject("WebGrid1"); grid.RootTable.GetNewRow().style.display = "none"; grid.Refresh(); }
This is to show the AddNewRow:
function Button3_onclick() { var grid = ISGetObject("WebGrid1"); grid.RootTable.GetNewRow().style.display = ""; grid.Refresh(); }
I hope it can help. Thank you and have a nice day.
Best Regards,
Andi Santoso
Hi Shawn, Unfortunately, we do not have the API for that feature at this moment. However, we can get its element and set the display to none. Here is the snippet on how to do so.This is to hide the AddNewRow: function Button1_onclick(){ var grid = ISGetObject("WebGrid1"); grid.RootTable.GetNewRow().style.display = "none"; grid.Refresh(); } This is to show the AddNewRow: function Button3_onclick() { var grid = ISGetObject("WebGrid1"); grid.RootTable.GetNewRow().style.display = ""; grid.Refresh(); } I hope it can help. Thank you and have a nice day.Best Regards,Andi Santoso
This will hide the row's fields but the actual row is still visible. If you click the row's initial column that is reserved typically for the row state icon, the row will re-appear. Is there a work around that ALWAYS hides the row so it will not re-appear?
I cant replicate you issur on my side. If you dont mind, could you provide me a screenshot or any more details which part of row's initial column did you click?
Thank you and have a nice day.
Regards,Niven
Hi Shawn,I cant replicate you issur on my side. If you dont mind, could you provide me a screenshot or any more details which part of row's initial column did you click?Thank you and have a nice day.Regards,Niven
Here's code to hide the New Row:
/// <summary> /// Handles the Treaty Claim's DataGrid control's OnInitializeLayout event /// </summary> /// <param name="sender">Sender</param> /// <param name="e">Event arguments</param> protected void grdTreatyClaims_OnInitializeLayout(object sender, ISNet.WebUI.WebGrid.LayoutEventArgs e) { // Initialize if (e == null) { return; } // Hide New Row // NOTE: This is done to ensure user uses custom button to create new rows this.grdTreatyClaims.RootTable.NewRowStyle.CssClass = Common.Utility.Constants.CSS_HIDE_CONTROL; }
I have also uploaded two images which shows the NewRow is initially hidden but then editable after clicking on the * icon.
I believe you can't achieve that on server side.
After I investigate further, why the row's initial column be able to be invoked because the code you give to me only access the new row not the row header(row's initial column). And we have not supported the row header yet.
Please try the following solution to hide the new row on window::onload method.
function window::onload(){ var grid = ISGetObject("WebGrid1"); grid.RootTable.GetNewRow().style.display = "none"; grid.Refresh(); }
Hope this helps. Please let me if this works on your side or not.
Regards,Niven.
Hi Shawn,I believe you can't achieve that on server side.After I investigate further, why the row's initial column be able to be invoked because the code you give to me only access the new row not the row header(row's initial column). And we have not supported the row header yet.Please try the following solution to hide the new row on window::onload method.function window::onload(){ var grid = ISGetObject("WebGrid1"); grid.RootTable.GetNewRow().style.display = "none"; grid.Refresh(); }Hope this helps. Please let me if this works on your side or not.Thank you and have a nice day.Regards,Niven.
Isn't this JS code the same as the server code that I am currently using? Regardless, any solution where a WebGrid's Refresh method is used causing a postback cannot be used due to performance.
No, this is not the same as the server code that you currently using. On your code, you only hide the style of the new row. But my code access the object of the new row and set it to hidden. This is why when you click on the row's initial state, it still can access the new row because you only hide the new row. not the row's initial state style. FYI, we do not support the row's initial state yet.
Regarding, the grid.Refresh(); will refresh only the WebGrid or else you will see a gap down the webgrid. However, this refresh method has no relationship with postback.
Hope this can clear your question.
I wasn't clear with my request.
I am currently using a button to trigger a new row. This is necessary because I need to perform some logic to default data, enable/disable fields, etc. and I could not find a way to do that when the user clicks the default "New Row". I hoped by hiding this row that I could only provide 1 way for the user to create a row: the button. My implementation removes the row so they cannot click but it comes back as I have shown you.
However, I am now getting an error because the button uses the "NewRow" object to create a new row;
'this.Column.ColumnType' is null or not an object
The 'this.Column.ColumnType' is null or not an object because the it cant find the NewRow.
What if I suggest you using the one at our WebGrid's sample, Client_ProgrammaticEdit?
Hope this helps.
Thank you.
Hi Shawn,The 'this.Column.ColumnType' is null or not an object because the it cant find the NewRow.What if I suggest you using the one at our WebGrid's sample, Client_ProgrammaticEdit?Hope this helps.Thank you.Regards,Niven.
That is not the desired approach of my company.
Is there a way to catch an event when the user clicks the default "Add New Row" area that is reserved for the WebGrid's New Row? This would fix my problem as I would not have to rely on providing a mechanism (button and WebGrid's Context Menu function) to display a new row and default data. If not, I need a way to prevent the user from clicking the default "Add New Row" area
I apologize for the misunderstanding. I think I am getting lost and want to clear the questions first.
So you want to access the new row but you dont want your users to add something within the new row field? If you want this scenario, I can suggest you to handle this scenario on OnRowSelect client-side event and set the validation if the ColumnType is new row then set to no edit type.
And If below is not the scenario you wanted, have you tried my previous snippet code that hide the new row? Even it is hidden, you can still adding a new row. Only the style was hidden you still can access it.
Once again, I apologize for my misunderstanding.
Hi Shawn,I apologize for the misunderstanding. I think I am getting lost and want to clear the questions first.So you want to access the new row but you dont want your users to add something within the new row field? If you want this scenario, I can suggest you to handle this scenario on OnRowSelect client-side event and set the validation if the ColumnType is new row then set to no edit type.And If below is not the scenario you wanted, have you tried my previous snippet code that hide the new row? Even it is hidden, you can still adding a new row. Only the style was hidden you still can access it.Thank you and have a nice day.Once again, I apologize for my misunderstanding.Regards,Niven.
I'll try to explain.
Is there a client-side event that occurs when the user clicks on the default "Add New Row" row that is displayed when the WebGrid is enabled to allow new rows? I need to perform some logic such as defaulting and loading controls on a new row. I didn't find any event so I am using a button and its OnClick event. So, I need a way to completely hide that "Add New Row' row which is done using the server-side code that I provided above. However, the user is still able to click into that row by clicking on that * character as I showed you. I need to prevent that.
Thank you for the re-explanation.
Please try my attached sample, hope this can fulfill your wanted scenario.
If not, please advise me with your scenario, then I will try to deliver as you wanted.
I'm using the Northwind Database. You can find it on Intersoft's folder.
I apologize but we do not support a client side event that occurs when the user clicks the default "Add New Row".
Thank you and have a nice weekend.
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