is there any column click event in ext js? - events

I am using Ext.grid.gridpanel.As in rowclick event, we can handle row click of grid..Is there any event to handle column click of grid?
i want to select a particular column of grid.

There is no special columnclick event on the gridpanel or the selection model, but you can listen to the
cellclick : ( Grid this, Number rowIndex, Number columnIndex, Ext.EventObject e )
event on the gridpanel itself - irrespective which selection model you use. Looking at the columnIndex you'll know which column has been clicked. If you want to react on clicks onto the header row, use the headerclick event instead.

Related

jqGrid custom recordtext and using loadComplete to get records count

I am trying to change the recordtext of a display grid to a custom format. I am using a treeview as the selector that refreshes the display grid. I need to find the total records for the grid and I am able to get this value using the getGridParam records method when I click on the treeview node and load the display grid.
However, after I get this value and try to create the custom recordtext, the record count is the previous value, not the current records count. I know that the gridComplete happens before the loadComplete, but even placing the get in the gridComplete and the set int he loadComplete, it still doesn't work, even with a reloadGrid trigger. If I click on the treeview node twice, I get the correct value.
I am thinking it is a timing issue as to when the new value is ready to set the recordtext. Any help would be great, thanks in advance.
I recommend you to try updatepager method, which updates the information on the pager. Alternatively you can do for example the following:
loadComplete: function () {
var p = $(this).jqGrid("getGridParam");
p.records = 123;
p.recordtext = "My View {0} - {1} of <i>{2}<i>";
this.updatepager();
}
to see the viewrecords

kendo grid doesn't react to changes if cell's (which is kendoDropDownList) value is empty string

I have a grid which is editable (editable: "incell"). One of it's fields is editable with kendoDropDownList. When I edit it's value grid reacts to changes and row gets updated. However if value is empty string then it doesn't.
kendoDropDownList itself does react to changes. I added 'change' callback to it and it kicks in.
How can I manually force grid to update row from within kendoDropDownList's 'change' callback?
You can go from dropdown to parent tr to get rownumber.
After that you can do something like:
var value = drop down value
var i = Get row index....
var data = $("#grid").data("kendoGrid").dataSource.data();
data[i].YourField= value;
$("#grid").data("kendoGrid").refresh();

Kendo UI Grid Edit popup's change update method return values

the normal way in kendo ui grid update data is add a edit popup.
What I want is, Think I change a value in text field.In update I added switch case and change the submit value. Then It will add that value and return that values to the grid. But I want to do is when get the return value and change it and show a different value in the grid.
Here is a example.....
In edit popup it has a input text field. I submit a value as "A". In the update I add a switch tells that If the value is "A" change the submit value to 1(number one).
Then it submit the value and show the value in grid as "1" not as the "A".
How I do this ???
I think you want a custom handler. In the grid you toss in this:
edit: function(e) {onEdit(e)},
and then on top of the page you do whatever logic you want to do
function onEdit(e) {
if (true) {
$("#Whatever").text('Hello') //Whatever in this case is a field in grid

Kendo grid group header customize to show the value and more

I have a Kendo grid that is groupable. The initial display needs to show all data items with no groupings displayed, i.e no 'group' and 'groupHeaderTemplate' are defined.
The grid contains a column (Suspension) where the value displayed is a translated dataitem value, i.e. if value > 10, display '*'.
When the user drags the Suspension column header cell to group, how can you customize the group header to show the value that it is grouping on plus the display 'value', i.e. 10-* ?
Do you mean on the button to turn off the group, or the group header text above each group in the grid ?
If the button to remove the grouping, I think you are stuck doing that manually.
If you mean the text above each group, columns have a groupHeaderTemplate property you can set.
groupHeaderTemplate: "Grouped By Name: #= value #"
See sample http://jsbin.com/IbITaT/2/edit

Fetching jqgrid row on click of hyperlink

I am facing problem in Jqgrid. I have a column with hyperlink and on the click of that hyperlink I want row data. Is this possible using Jqgrid. when I am using "getGridParam" I am getting row id as null.
There are two possibilities you can try here:
1) You can use a custom formatter to create the hyperlink, and have a custom attribute on the link where you put in the rowid (prefix the custom attribute name with 'data-' to keep it html5 compatible). Alternatively you could call a javascript function explicitly passing the row id.
2) Instead of the hyperlink's event itself, try using the onCellSelect event of jqGrid where you get the row and column id of the clicked cell, even if its a hyperlink. But this would trigger the event even if the user clicks anywhere inside the cell, not just on the link!.
I'm sure you found the answer to this by now but for some of you using ASP.NET WebForm here is what I used.
Create the Custom Formatter and add it to the column where you want the link to appear:
My columns are from a database I use a Select statement as so:
switch (jqGrdCol.DataField)
{
case "xxx":
CustomFormatter hypLinkxxx = new CustomFormatter();
hypLinkxxx.FormatFunction = "xxxformatOperations"; --> **JavaScript Function**
jqGrdCol.Formatter.Add(hypLinkxxx);
break;
}
Then in the Javascript function:
function xxxformatOperations(cellvalue, options, rowObject) {
return "<a href=somefile.aspx?xxx=" + rowObject[0] >" + cellvalue + "</font></a>"
}
I get the value of the column as a hyperlink.
I had a similar issue and was did look into your question to figure out a solution and I have found out a solution to this.
The solution is by using onCellSelect: function(rowid, index, contents, event)
this gives the rowid and contents ie the content of the cell you have clicked or selected
therfore you can get the entire row of contents which includes your hyperlink as well

Resources