Heyo,
I just assume that you use datatype:local for that? Its hard to tell without your code
Have you set the editUrl correctly? – Even if jqGrid does not send anything to a server in local-mode it still needs to know what to do for editing.
editurl: “clientArray” -> tells jqGrid to write changes into the local array you give it.
onSelectRow: function(id){
 if(id!=lastsel){
jQuery('#list').jqGrid('saveRow',lastsel);
//Set Null, select new Row
lastsel = null;
jQuery('#list').jqGrid('editRow',id,{keys: true, aftersavefunc : function(id){
//Do Array Manipulation here
myArray[id] = ........;
}});
...
(I hope its somewhat readable)
There are plenty of examples to be found in the wiki, or on the demo page if you look through it (which I reccomend)
I resolved the issue – after experimenting a bit:
Instead of ‘xmlstring’ I now use datatype: function
datatype: function(postdata){
            var list = jQuery(“#list”)[0];
                list.addXmlData(productListData);
}
Works well – even though I still dont know why ‘xmlstring’ didnt work.
Â
Either way, thanks for your help ![]()
Ich checked it – and I also checked my Data.
But there is a difference between your code and mine.
The Code you made is uses a xml datatype- I use xmlstring.
I tried your example with the whole chunk of Data I need to retrieve – and found an error on my side (replacements on special Characters) – fixed that and tried your code again – it worked.
BUT
I tried the same thing with my code now – changed the datatype to xml – and referenced the same xml file with all the data. This worked as well
Now I changed the datatype to xmlstring, copy + pasted the xml-file into a hardcoded string, tried to run it again: I got the same exception (Cannot read property ‘length’ of null)
The reason I use xmlstring was just convienence, I call a Webservice with a specific SOAP Message and get the Products filtered that I need – the specific xml structure that returns can be found here:
This is the exact structure I give jqGrid, if I use the datatype:xml – it works
if I copy the exact same Message unedited as string hardcoded into the script and use datatype:xmlstring – it does not (but it shows everything when I configure groupind:false – and enable grouping afterwards – but only after triggering something else)
Now my question would be does datatype:xmlstring not support grouping? – I really couldnt find anything that says it doesnt…
So,
Apperantly since IOs 7.0 Apple made it “near” impossible to set focus programmatically – you can only set Focus on a select few user initiated events, such as touchend/clickend events.
Even if it is kind of a bummer – I guess it can’t be helped, thank you anyway for your help and replies.
Â
I have one other question regarding teh manipulation of attributes of the textboxes generated by the edit mode. But I am not sure if I should open a new Thread or just keep it in this one? (not so sure about the forum policies here…)
I dug through the JqGrid Code and found what is crashing – but I am not quite sure what it does:
(taken from jquery.jqgrid.src.js – Row 11.776)
|
1 2 3 4 5 6 7 8 9 10 11 |
var leaf = len-1 === n.idx;<br />             if( leaf ) {<br />                var gg = grp.groups[i+1], kk, ik, offset = 0, sgr = n.startRow,<br /> //Line that gives the exception:<br />               <span style="text-decoration: underline"><strong>  end = gg !== undefined ? grp.groups[i+1].startRow : grdata.length; </strong></span><br />                if(grp._locgr) {<br />                   offset = (page-1)*rn;<br />                   if(offset > n.startRow) {<br />                      sgr = offset;<br />                   }<br />                } |
I assume the grdata is the Griddata, so the lenght of the Griddata is undefined – not 0.
It seems to me I either configured something completely wrong – or my process of giving the Grid data is erronous:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
function showProductList()<br /> {Â Â Â <br /> Â Â Â if(reloadProducts)<br /> Â Â Â {<br /> Â Â Â //HTML Web Service CalL<br /> Â Â Â var xmlhttp=false;<br /> Â Â Â var getCustomersUrl =Â serviceTrigger; //Web Service URL from which I retrieve the XML<br /> Â Â Â xmlhttp = new XMLHttpRequest();<br /> Â Â Â <br /> Â Â Â xmlhttp.open("POST", getCustomersUrl, true); //B1if only allows POST requests!<br /> Â Â Â xmlhttp.setRequestHeader("Content-Type", "text/xml; charset=utf-8");<br /> Â Â <br /> Â Â Â var data = '<soapenv:envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/"><soapenv:header></soapenv:header><soapenv:body><tem:getproductlist><tem:group>'+selectedGroup+'</tem:group></tem:getproductlist></soapenv:body></soapenv:envelope>'<br /> Â Â Â console.log(data);<br /> Â Â Â xmlhttp.onreadystatechange=function () {<br /> Â Â Â Â Â Â <br /> Â Â Â Â Â Â if(xmlhttp.readyState==4)<br /> Â Â Â Â Â Â {<br /> Â Â Â Â Â Â Â Â Â productListData = xmlhttp.responseText;<br /> Â Â Â Â Â Â Â Â Â buildProductGrid(); // ---> Method that builds my grid<br /> Â Â Â Â Â Â Â Â Â reloadProducts = false;<br /> Â Â Â Â Â Â }<br /> Â Â Â Â Â Â console.log("Loading of Service not done yet");<br /> Â Â Â Â Â Â <br /> Â Â Â }; //END of READY STATE FUNCTION<br /> Â Â Â <br /> Â Â Â //Sending the Request<br /> Â Â Â xmlhttp.send(data);<br /> Â Â Â }else<br /> Â Â Â {<br /> Â Â Â Â Â Â buildProductGrid(); // ---> Method that builds my grid |
Â
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
function buildProductGrid()<br /> {<br />    jQuery(document).ready(function () {<br />    <br />          //Last Selected Row - used for Selection Handling<br />          lastsel = null;<br />          var monthHeaders = getMonthHeader();<br />          //Definition of Grid<br />       $("#list").jqGrid({<br />          datatype: 'xmlstring', //Datatype of information represented, will be XML due to HTTP call I guess?<br />          datastr: productListData, // --> this is what is created in the previous function<br />        colNames: ,monthHeaders[1],monthHeaders[2],monthHeaders[3],monthHeaders[4],monthHeaders[5],monthHeaders[6],monthHeaders[7],monthHeaders[8],monthHeaders[9],monthHeaders[10],monthHeaders[11]],//'Check','Notes'], //Header Layer Definition<br />       colModel:[<br />          //GroupColumn<br />          {name:'xxx', index:'xxx',width:1,editable:false,search: false},<br />            {name:'itmc',index:'itmc', width:80, align:"left",search:true, key:true},<br />            {name:'pzn',index:'pzn', width:65, align:"left",search:true},<br />            {name:'itemnm',index:'itemnm', width:200, align:"left",sorttype:"text",search:true},<br />          //EditableParts<br />          {name:'amount', index:'amount', width:40,align:"center",sorttype:"number", editoptions:{size:4, maxlenght:4, height:40},editrules:{number:true},editable:true,search:false},<br />          {name:'nr',index:'nr',width:40,align:"center",sorttype:"number",editoptions:{size:4, maxlenght:4},editrules:{number:true},editable:true,search:false},<br />          {name:'p', index:'p',width:30,align:"center",sortable:false, edittype:'checkbox',editoptions:{value:"Ja:Nein"},editable:true,search:false},<br />          {name:'k', index:'k',width:30,align:"center",sortable:false, edittype:'checkbox',editoptions:{value:"Ja:Nein"},editable:true,search:false},<br />          {name:'a', index:'a',width:30,align:"center",sortable:false, edittype:'checkbox',editoptions:{value:"Ja:Nein"},editable:true,search:false},<br />          //END EditableParts<br />            {name:'year12',index:'year12', width:40, formatter:'text', align:"center",sorttype:"number",search:false},<br />            {name:'year13',index:'year13', width:40, formatter:'text', align:"center",sorttype:"number",search:false},<br />          {name:'mon1',index:'mon1', width:35, formatter:'text', align:"center",sorttype:"number",search:false},<br />          {name:'mon2',index:'mon2', width:35, formatter:'text', align:"center",sorttype:"number",search:false},<br />          {name:'mon3',index:'mon3', width:35, formatter:'text', align:"center",sorttype:"number",search:false},<br />          {name:'mon4',index:'mon4', width:35, formatter:'text', align:"center",sorttype:"number",search:false},<br />          {name:'mon5',index:'mon5', width:35, formatter:'text', align:"center",sorttype:"number",search:false},<br />          {name:'mon6',index:'mon6', width:35, formatter:'text', align:"center",sorttype:"number",search:false},<br />          {name:'mon7',index:'mon7', width:35, formatter:'text', align:"center",sorttype:"number",search:false},<br />          {name:'mon8',index:'mon8', width:35, formatter:'text', align:"center",sorttype:"number",search:false},<br />          {name:'mon9',index:'mon9', width:35, formatter:'text', align:"center",sorttype:"number",search:false},<br />          {name:'mon10',index:'mon10', width:35, formatter:'text', align:"center",sorttype:"number",search:false},<br />          {name:'mon11',index:'mon11', width:35, formatter:'text', align:"center",sorttype:"number",search:false},<br />          {name:'mon12',index:'mon12', width:35, formatter:'text', align:"center",sorttype:"number",search:false},<br />          //{name:'check',index:'check', width:40,editRow:true, editable:true, align:"center", edittype:'checkbox',editoptions:{value:"Yes:No"}},<br />            //{name:'note',index:'note', width:100,editRow:true, sortable:false, editable:true, editoptions:{maxLenght:'40'}}<br />        ],<br />        //pager: '#pager', //Pager Setup - to go back and forth between entrys #Might solve our display problem!<br />        rowNum: 9999,      //Number of Rows to display, the pager switches back and forth<br />        //rowList: [10, 15, 20], //Defines a drop down Menu to change rowNum (probably not usable in Ipad dev)<br />        sortname: 'xxx',   //Initial sorting column pretty straight forward<br />        sortorder: 'asc',   //Sortorder self explanatory<br />        viewrecords: true, //Number of total records available<br />        gridview: true,   <br />        autoencode: true,<br />        caption: selectedCustomerName,<br />       height: 500,<br />       ignoreCase: true,<br />       grouping : true,<br />       groupingView: {<br />          groupField: ,<br />          groupColumnShow: [false],<br />          groupText: ,<br />          groupCollapse:false,<br />          //groupDataSorted: true,<br />          //groupOrder:<br />       },<br />       onSelectRow: function(id){<br />          if(id!=lastsel){<br />             jQuery('#list').jqGrid('saveRow',lastsel);<br />             //Adding Value for Submission Counter<br />             makeAmountOutput();<br />             <br />             //Set Null, select new Row<br />             lastsel = null;<br />             //jQuery('#list').jqGrid('editRow',id, { keys:true, oneditfunc : function( rowid) {$("#"+rowid+"_NR").focus();}};<br />             jQuery('#list').jqGrid('editRow',id, {  keys: true,  oneditfunc : function( rowid) {    $("#"+rowid+"_NR").focus();  } });<br />             lastsel=id;<br />             <br />          }else<br />          {<br />             makeAmountOutput();<br />             jQuery('#list').jqGrid('editRow',id, {  keys: true,  oneditfunc : function( rowid) {    $("#"+rowid+"_NR").focus();  } });<br />          }<br />       },<br />       scrollOffset: 0,<br />       editurl: "default.html",<br />       hidegrid:false,<br />       <br />    }); //JqGird Definition END<br /> <br />    //Definition of Filter Search<br />    $("#list").jqGrid('filterToolbar',{<br />       searchOnEnter: false<br />       <br />    });<br />    <br />    });   <br /> }; |
 I dont see any mistakes – but I would assume I use Jgrid in a way it is not intended. Would anybody have any idea where my mistake is? – I really dont think it is Jqgrid that bugs out on me
I am still lost with this problem…nobody has any idea?
Worked like a charm on my PC so far
thank you very much – I will edit once I could test it on my Ipad!
thanks agains!
Hey Tony,
Â
Thanks a lot unfortunately – I tried using the group: true option, but the grid then doesnt display anything and the console presents me with an exception:

Thats the reason I started using the loadComplete, and enabling the Grouping afterwards – apparently something isnt loaded or correctly initiated hence the TypeError…or do I missinterpret something horribly?
Â
EDIT: I added the style in the head – works wonders on performance – thank you very much
Hi,
Â
This is for example the way I tried to do it: (you can see I tried it via different ways)
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
onSelectRow: function(id){<br /> Â Â Â Â Â Â Â Â Â if(id!=lastsel){<br /> Â Â Â Â Â Â Â Â Â Â Â Â jQuery('#list').jqGrid('saveRow',lastsel);<br /> Â Â Â Â Â Â Â Â Â Â Â Â //Adding Value for Submission Counter<br /> Â Â Â Â Â Â Â Â Â Â Â Â makeAmountOutput();<br /> Â Â Â Â Â Â Â Â Â Â Â Â <br /> Â Â Â Â Â Â Â Â Â Â Â Â //Set Null, select new Row<br /> Â Â Â Â Â Â Â Â Â Â Â Â lastsel = null;<br /> Â Â Â Â Â Â Â Â Â Â Â Â jQuery('#list').jqGrid('editRow',id,true);<br /> Â Â Â Â Â Â Â Â Â Â Â Â lastsel=id;<br /> Â Â Â Â Â Â Â Â Â Â Â Â var focusElement = id+'_NR';<br /> Â Â Â Â Â Â Â Â Â Â Â Â //alert(focusElement);<br /> Â Â Â Â Â Â Â Â Â Â Â Â $(focusElement).focus();<br /> Â Â Â Â Â Â Â Â Â Â Â Â //$(document).bind("mouseup",function(event) {<br /> Â Â Â Â Â Â Â Â Â Â Â Â //Â Â Â jQuery('#list').jqGrid('getCell',id,'NR').focus(); //selects specific row and underlying cell and sets the focus<br /> Â Â Â Â Â Â Â Â Â Â Â Â //});<br /> Â Â Â Â Â Â Â Â Â } |
As I said in another Thread of mine (and most likely is shown by my lack of talent to format anything correctly ^^”)
I am rather new to Jscript / HTML, but I start to get the hang of it.
Anyway I really appreciate the help – even though I have vanished for the past month…
Hello,
Sorry for my very late reply – but the company gave me a more pressing issue, and then I got sick.
Here is one oft he XML-Strings I would use:
Â
          Â
              1
              1
              2
             Â
                 Dr. Liebe
                 35931
                Â
                 Daylong 50+ extreme Stick 8 ml
                Â
                Â
                 Nein
                 Nein
                 Nein
                 999
                 999
                 1
                 2
                 3
                 4
                 5
                 6
                 7
                 8
                 9
                 10
                 11
                 12
             Â
             Â
                 Dr. Liebe
                 8001
                 1751116
                 Excipial Lipocreme 300 g
                Â
                Â
                 Nein
                 Nein
                 Nein
                 999
                 999
                 1
                 2
                 3
                 4
                 5
                 6
                 7
                 8
                 9
                 10
                 11
                 12
             Â
Ideally what I would want is the products to be Grouped under the Name Dr. Liebe (which would be the producer of the products) – again it does work – but only after Sorting via the Header or using search – or even triggering an edit.
The Key:true would be the colum ItemCode (itmc) – is it still possible to use Grouping after that?
I just dont know what I am doing wrong…
Copyright 2014 TriRand LtdAll Rights ReservedRSS
Back to Top