row.entity.xxxx property doensn't match after sorting - javascript

Ok so i have a problem. I have a grid with about 5 columns.
They are:
TaskQueryID, Comment1, Comment2, TaskID, ProjectName.
Data is loaded via WebAPI and everything is dandy.
Every cell in the grid runs off same template which turns the text in the cell into a link. The point of it is to the use that link to load more information about that row into the same grid. This works as expected as well.
The problem i have is when i sort the columns. During initial load, the data shows, i click lets say 3rd row link, i get correct detailed data. I reload the page, try it again, works fine. THEN i repeat the test but after load i sort by random column (i tried all of them) and click said 3rd row link again and i get a problem. Data shows up but not for the sorted 3rd row link but for the original load 3rd row link.
The underlying data is not sorted, just the UI?
I'm a bit stumped.

Solved it. Turns out the parameters were referenced from the grid scope instead of the current click scope. I'm just getting into Angular so this difference eluded me. Hope this helps somebody!

Related

I am having a script issue where copyto isn't finding the correct row to copy to

I have been struggling to get my Apps Script to work consistently. I am trying to copy row from one sheet to another. my script knows to copy row based on dropdown in column 9 this part works flawlessly every time. The inconsistency comes when I ask it to find first empty cell in column"A" of corresponding page and copy there.
Sample sheet has a read me page for more specifics on what I am trying to do.
https://docs.google.com/spreadsheets/d/1befqsGQvbPfn0XTGrygLOGcrUIMrICUagJVH0S-2rDw/edit?usp=sharing
I tried to use last row but that will not do as I am copying data into rows that are not empty. Hence the need for the copy to go to empty cell in column "A"
The answer in Google Sheets community solves the issue using the appendRows_() utility function:
appendRows_(targetSheet, values, 1);
sheet.deleteRows(e.range.rowStart, 1);

Simple DevExpress ASPxGridView returns row from previous binding (JS and VB)

I have a simple GridView that gets data from SQL database on web page load (using custom callback and binding, it lists the info fine, i can change between pages if rows go beyond 15, and i can double click on any page and get the values with JS using the doubleclick event with GetRowValues and GetFocusedRowIndex, and then assigning the values to various ASPxTextBox controls, all works fine...
Until, i do another query/binding on same GridView and i click on the row, i get the old information of when the page loaded, on screen i see the new rows fine, but JS gets the old rows, it recognices the row number fine, but gets the old row from that position
Can anyone post an example of how can i get this to work?
All i need is to fill the grid with simple query, and then on client side, when double click on row, get the info and copy it to text boxes, the grid must be capable of executing different querys without refreshing all the pages content, it should act like its a normal search in a database...
Thanks for the help in advanced, ive searched for the answer everywhere and havent found it, various people have the same problem, but i cant figure out how can i get it resolved using JavaScript and VB

How can i display the table row that just got clicked, on another page?

I'm working on a website where you can see buildings on a map and where users can click on a table row (1) (where informations about the building is shown) to get redirected to the map page. Additionally, and thats where i'm stuck, the clicked table row should appear on the first page (2).
So the question is: how can i display the table row that just got clicked, on another page?
thanks for your help!
Pass the index of the row that is clicked as props
Even if it's difficult to answer to this question since it's very generic, I'll try to assume that you are missing the basic approach and need a starting point on how resolve this. Once you clicked on the row, you can pass the data to the new URL. Assuming that you are calling a new page, the row should be wrapped in an anchor element and in this case the data can be passed with a GET request, included in the URL. You can have a look to the W3school website page talking about GET method
to learn more about it.
If you are trying to do this as a single page application with react instead, start looking at React documentation on how components and props work to pass props down to other components.
Hope you find this helpful!

How can I get the number of rows displayed in a jqGrid?

Maybe this information is out there and my Google-fu is failing me, however I can't seem to find the answer. How can I get the number of rows being currently displayed in a jqGrid?
Every question and answer I've found on this topic tells you how to get either the total number of rows (displayed or not) or the number of rows loaded by an external service. Instead, I'm trying to get how many rows are being displayed in the current page of the jqGrid. One of my jqGrid attributes is rowList:[10,20,30], but I'm not sure how to access which one is selected myself.
All I want is how many rows are being currently dislpayed on each page of the jqGrid. The closest thing I've found so far has been this Q&A, but this displayed how many <tr>s there are and wasn't really what I needed.
$('.ui-pg-selbox').val()
Tested on the latest jqGrid (4.4.1)
Of course, if you have more than jqGrid per page, you can use an wrapper to ensure that it is the one you're looking for.
$('#myjqGridWrapper .ui-pg-selbox').val()
Not sure whether it's the best way, but it gets the job done.
The space means a descendant selector, that is it looks for elements containing the class ui-pg-selbox which are descendant of an wrapper #myjqGridWrapper. That would require having a div or some other wrapper around your table.
UPDATE: Also, if you have the table ID or a reference, you can use a more sturdy way of querying its jqGrid instance's .ui-pg-selbox:
$('#jqgridTableId').closest('.ui-jqgrid').find('.ui-pg-selbox').val()
The following will return you the number of displayed rows on a grid's page:
$('#myjqGridWrapper').getGridParam('reccount');
You shouldn't rely on the view for information. You should pull this information out of the JQGrid model. You can do so by calling the getGridParam method like so:
var rowNum = jqGrid.getGridParam('rowNum');
See here for more information: http://www.trirand.com/jqgridwiki/doku.php?id=wiki:options

Adding a new row to a dynamic ASP.NET Table Control, at position x - Problems with Viewstate after postback

I am creating a dynamic table control with ASP.NET/C# and the table is being used to hold a form. I need to allow users to click on a button in a row and make a duplicate of that row right below the original. My page is also using AJAX and jQuery.
I have tried to use Table.Rows.AddAt(indexoforigrow+1, newrow) but I get an error that the index is out of the range of values. I figured maybe I wasn't getting the original row's index correctly so I just tossed in a 1 and still got the error.
I also noticed that when I press the button to execute the code, the table disappears. Any ideas on how to fix that?
I am thinking that if I am unable to get these issues fixed I will have to loop through the table and submit the data to a temp table, adding a new row where indicated. Then I would pull all of the data back out and display again.
EDIT
I moved on when I could not get this working and tried to setup my submit functions to loop through the data and submit it to a db and realized that I am experiencing the same issues when clicking the submit button as when I click the add row button. It appears that my issue is really with viewstates/postback.
I did some reading on this and from what I can tell the solution is to re-create the dynamic control on page load every time. But I am confused about how I can do this if I have no idea how many rows/cells I have and how is the information the user entered kept in the form? I have no way of saving the information to a DB or anything because as soon as submit is clicked it all disappears.
Have you considered using a different control? One of the grid controls might better serve your purpose.
I've handled situations (that sound) similar to what you're describing by using the footer of a GridView (among other ways). The big trick is to bind the display object (Table, GridView, etc.) to a list of objects. Then you manipulate the list of objects, rebinding the display object after the list has changed.
You will need to persist this list in some manner, or you could wind up with the list being reset to null. One way would be to save it as part of the session.
At any rate, the idea is to have a display object (GridView) bound to a list of objects. When the user clicks 'add', an item is added to the list. Save the list, then call the GridView.DataBind method.
You are on the right track with re-creating the dynamic table each time the page loads. I have dome similar things and my solution was to keep a client state in a hidden field on the page. Every time you add a row to the table on the client, increment a counter or adjust the state data in the hidden field. Then, on the server-when the page posts back, read from that hidden field to know how many rows were added on the client. You will have to use some kind of naming convention for the new rows you add(and the widgets in them) so you can re-create them on the server.
A simpler option may be to use an UpdatePanel. Rather than try to add the rows on the client, your "add row" button would cause a partial update. The server side code would add the new row to the table and the viewstate would be updated.
I ended getting my data guy to do a bit more processing on his end so that I could just bind a ListView to a sproc. Solved a few of my problems.
Thanks for the helpful comments.
Just returning to this almost a year later because I faced a similar issue in my current project. I was doing a few things wrong my first time around. First, I did indeed need to recreate the controls every load, but I also had to create them earlier in the page cycle. I was trying to create them during page load, which is after the viewstate is loaded.
The controls need to be recreated with the same ID before viewstate is loaded. I went with page init and it worked fine.

Categories