multi level group headers in jqgrid - jqgrid

Main-header
subhead1 |subhead2 |subhead3
subhead1 |subhead2 |subhead |subhead4
----------------------------------------
column names come here
----------------------------------------
Can we have the multilevel headers in JQGrids as shown above.Can any one please.

It's not clear what you mean under subheadres because you placed all column names in the last line and included 3 levels or come kind of headers.
What you can do is use caption option of jqGrid to create "Main-header". You can additionally create one level of column grouping with respect of setGroupHeaders method like described in the documentation. More levels of subheads are not supported.
UPDATED: A possible implementation of multilevel grouping of headers I described in the answer.

Related

BIRT suppress multiple duplicate columns

I am working on a BIRT report. Its records are grouped on the basis of the status column. I was looking for an option in the Eclipse BIRT tool by which I can hide combinations of multiple columns in a row which are repeating. I have attached screenshots for both the current report and the expected report structure.
I tried the "suppress duplicate" option but that is limited to a single column. I am not able to apply this on multiple columns together. I couldn't figure out any other option. Please suggest any solution in the tool or do I need to change my query to return the result in the expected format?
Actual Result:
Expected Result:
There are three obvious ways to hide duplicate values.
All of these require you to configure this per column (BTW I don't understand why you consider this to be a problem).
As you already did: Use "suppress duplicates" at the column level.
Add more groups to your table after the existing group.
E.g. one group for the first column (whatever that is).
Then you can choose "Drop" "detail" in the properties of the corresponding group header cell. It's a bit difficult to get the layout right this way.
In your data set, if it's SQL, you can use a little construnct with CASE and the LAG analytic function to compare the column value to that of the previous row, and if they are equal, return NULL instead (pure SQL solution).

SSRS sort not working

On a number of reports I have noticed that setting sort options through the tablix properties does not work. I choose the data I'd like to sort by (date) and set the option (Z to A), but the report still shows unsorted. Has anyone else seen this issue? I have read that updating the report xml to include the sort may be what needs to be done because the report builder does not preserve the changes made. Haven't gone down that road yet as I'm looking to see if there's a fix already identified.
Date Type Lead Name State distance Consultant ZIP State 1 Level Reason url
Those are the columns from the export with data filling each column. Can't give too much info because it shows phone numbers and addresses.
One option is to sort the data in your dataset. Then you can leave it and SSRS will honor that.
As the others mentioned, make sure you check the datatype so it's not trying to sort the dates as a string.
Set the sort priorities at the group level, not on the table or dataset properties.
You should never have to edit the XML to get this to work. This is a basic built-in feature that most reports use.
Do you have groups on your tablix? if yes, did you try sorting it with the Row Groups or Column Groups at bottom instead of the sorting properties of the tablix?

how can I get the count of matches for filters of jqgrid

I have pulldown select box for filtering the jqgrid (not using the builtin navbar, and data is local). I'd like to grey out the ones that have no matches in the grid.
Is there a way to perform the query to just get the count without updating the ui rows so I can initialize/update the pulldown to enable only those with matches (or even better to supply the number of matches in the menu)
EDIT:
To clarify I want to disable/greyout my filter menu items not the table row items
Internally jqGrid uses $.jgrid.from method to apply the filter to the data. What you want to implement it's probably not just getting the counts because you wrote:
I'd like to grey out the ones that have no matches in the grid.
Nevertheless all want you want is possible to implement. You will have to write some JavaScript code which uses $.jgrid.from($("#list")[0].p.data) for initialization. Then you have to construct the query using methods like contains, lessOrEquals, andNot, orNot and so on. Then you should apply the query with respect of var queryResults = query.select();. If you examine ids in the queryResults you can make gray all items which are not in the set.
I recommend you to read and to debug the addLocalData method of jqGrid and which contain all what you need. Moreover I recommend you to set breakpoint on the line and examine match and results variables. It this is not simple of cause, but if you need some individual solution you have to invest time in it.
UPDATED: I though more about the described problem. My recent answer with the demo demonstrate how you can solve your problem.

Hierarchical Telerik RadGrids: How can I get rid of sorting bugs?

I'm using a hierarchical RadGrid (Telerik control) but there are some bugs regarding the sort of the second level. I have two levels and the second level is loaded based on the first level.
Columns of the first level: Foo1, Foo2, Foo3
Columns of the second level: Bar1, Foo2, Bar2, Bar3
Binding is issued through a function.
Problems:
If a single row of the first level is expanded (we can see a single sub-grid from the second level) and I want to sort by Bar1, the sort happens, but an error occures:
Uncaught TypeError: Cannot call method 'sort' of null
If a single row of the first level is expanded (we can see a single sub-grid from the second level) and I want to sort the second level by Foo2, the sort happens for the parent grid's (!) Foo2 column
If two rows of the first level are expanded (we can see two sub-grids from the second level) and I want to sort both the subgrids by the same column a strange rectangle appears instead of the ascending/descending sign, I get the same error as described in the first problem but the sorting is not issued.
I would like to get rid of these problems, my question is the following:
If we have a hierarchical RadGrid and both the first and the second level is sortable how can I implement a sort of the second level to be free of bugs?
Thank you in advance for your responses.
I've found the answer.
The problem is that the columns are automatically generated and hierarchical RadGrids where the columns are automatically generated have a bug in Telerik. When a column is not sorted, its header (th tag) doesn't have rgSorted class and doesn't have an input tag as a child. When the column is sorted, it has an rgSorted class and it has an input inside it. The input has rgSortedAsc or rgSortedDesc class, depending on the sorting direction. So, if I want to solve it I'll have to make a hack, which will be incompatible with future versions. This is painful, because I need the second level of my grid, I need the columns to be automatically generated (the columns are revealed at runtime) and I want to be able to sort them, but, unfortunately the answer to my question is that there is no solution for this bug.
Please view this thread on the Telerik forum:
http://www.telerik.com/community/forums/aspnet-ajax/grid/hierarchical-radgrid-sorting-problems.aspx#1782047
I hope I've saved some fellow programmers from the torture I've faced.
Thanks for the comments, fellows,
Lajos Arpad.

changing JQgrid column name dynamically

I just need to rename JQgrid column dynamically as per user selection from a list of options. How can I do that?
You can use this syntax:
jQuery("#grid1").jqGrid('setLabel', 0, 'NewLabel');
This will change first column name to NewLabel in your grid with id=grid1.
The latest version of jqGrid (4.1+ - possibly earlier) no longer appears to support the column index based setLabel approach described by Galichev, a columnName based approach is provided instead:
jQuery("#grid1").jqGrid('setLabel', 'columnName', 'NewLabel');
See the jqGrid Methods wiki for more information.
I've left the previous answer unedited as this approach may be valid in versions prior to 4.1.
According to the jqGrid Documentation, colNames cannot be changed after the grid is created.
However, you might be able to simulate a column name change by using several columns. Then you can hide all of them except a single one which will be shown to the user. When the user selects another, just swap in the selected column. For example, if valid columns are [A, B, C, D] you might start by only showing A. Then if the user chooses C, hide A and show C. The main disadvantage to this approach is that you will need to copy the same data to many columns, however.
Update
Per Galichev's answer, you can use the setLabel method to rename a column header.
*setLabel : * colname the name of the column (this parameter can be a number (the index of the column) beginning from 0
However the index param does not work with version 4.1 and above.
Jqgrid uptop version 4.0
$(tableId).jqgrid("setLabel", 0, "BBBBB");
Jqgrid version 4.1 and above
Try using these
$(tableId).setLabel("ColumnName", "AAAAA");
or
$(tableId).jqgrid("setLabel", "ColumnName", "BBBBB");
JQGrid1.Columns.FromDataField(ColumnName).HeaderText = ColumnName;
I gave my column name a div
'<div id="DateDivId">Date</div>'
Then I just changed it the normal way, getElementById, change contents.

Resources