jQWidgets Forums

Forum Replies Created

Viewing 11 posts - 16 through 26 (of 26 total)
  • Author
    Posts

  • Nagoor
    Participant

    hi peter,

    i agree with you. in my case, i am populating grid coloumns and datafields dynamically for which i am getting the data from the server. so, we are not sure about the coloumn text and datafield as they will be populated in loop. and editor will be called onclicking the cell, so at that time i need to find the text in coloumn header so that i can write logic there based on the coloumn name as per my requirement. here is the sample..

    var colDataFieldArray =[“userName”,”emailId”,”company”,”Flag”];//This is the array which contain Dynamic column datafields first set

    for(var i=0;i<(colDataFieldArray.length);i++){
    var colStr = $.trim(colDataFieldArray[i]);
    gridColumns.push({ text:$.trim(colDataFieldArray[i]), dataField: colStr, editable:false, align : ‘center’, cellsalign:’center’,width: 150});
    dataFieldColumns.push({name:colStr, type: ‘string’});
    }

    gridColumns.push({text: “User Id”, dataField: “userId”, hidden:true, cellsalign:’center’});
    dataFieldColumns.push({name: “userId”, type: ‘string’});

    // coloumns for second set to perform editor operation

    for(var i=0;i<(serviceArray.length);i++){
    var colStr = $.trim(serviceArray[i]);

    gridColumns.push({ text:$.trim(serviceArray[i]), dataField: $.trim(serviceArray[i]),align : ‘center’, editable:true,cellsalign:’center’, width: 150,columntype: ‘dropdownlist’,

    createeditor: function (row, cellvalue, editor, celltext) {
    var list = [cellvalue,”none”]; // here in place of cell value i want the column header text

    editor.jqxDropDownList({ autoDropDownHeight: true, source: list, promptText: “Please Choose:” });
    },

    geteditorvalue: function (row, cellvalue, editor) {
    // return the editor’s value.
    return editor.val();
    }
    });

    dataFieldColumns.push({name: $.trim(serviceArray[i]), type: ‘string’});
    }

    here, i am populating two sets of coloumns as you can see. for the secong set i v=have to perform editor operation. if i try to get the datafield value , obviously its showing undefined, so i suggest you can add one more parameter so that to get the coloumn header text or value.
    hope you understand my problem.

    Thanks in advance

    in reply to: What is the uid? What is the uid? #53825

    Nagoor
    Participant

    hi Dimitar,

    if we dont want this uid to export when we use export data, what should we do..

    Thanks


    Nagoor
    Participant

    hi genechka,

    i too faced the same problem before, but we shouldn’t blame the natural behaviour of the grid since it was designed keeping the other functionalities in view as well. i found a sloution for myself which i can share with you. hope it helps..

    var rows = $(“#jqxgrid”).jqxGrid(‘selectedrowindexes’);
    for (var m =rows.length-1; m >=0; m–)
    {

    var selectedrowindex = rows[rows.length – m – 1];
    if (selectedrowindex >= 0) {
    var id = $(“#jqxgrid”).jqxGrid(‘getrowid’, selectedrowindex);
    deletedata[i]=id;
    }
    i++;
    }

    deletedata=deletedata.sort();

    for (var k=deletedata.length-1; k>=0;k–){
    $(“#jqxgrid”).jqxGrid(‘deleterow’,deletedata[k]);
    }

    $(“#jqxgrid”).jqxGrid(‘clearselection’);

    selected row indexes method works with the order in which you have selected the rows, and it might not be in sorted order. pls try this.

    Thanks.

    in reply to: Grid row selection problem Grid row selection problem #53818

    Nagoor
    Participant

    hi madhuri,

    give selection mode as single row. since you are giving checkbox as another coloumn implicitly, you need not to give selection mode as check box. and using this checkbox coloumn for selecting and unselecting rows.. initiate cellbeginedit and cellendedit functions as follows after grid definition.

    $(“#jqxgridForFieldSec”).bind(‘cellendedit’, function (event) {
    if (event.args.value) {
    $(“#jqxgridForFieldSec”).jqxGrid(‘selectrow’, event.args.rowindex);
    }
    else {
    $(“#jqxgridForFieldSec”).jqxGrid(‘unselectrow’, event.args.rowindex);
    }
    });

    i would also recommend you to initiate ‘clearselection’ event after removing the selected rows in grid.

    $(“#jqxgridForFieldSec”).jqxGrid(‘clearselection’);

    hope it helps..


    Nagoor
    Participant

    Hi peter,

    Thank you. its working.


    Nagoor
    Participant

    hello anandbabu,

    i used your method to create dynamic coloumns. i tried to implement cellserenderer function , but its not working. is there any way to implement cells renderer with dynamically generated coloumns. here is the sample of my code.

    gridColumns.push({ text:$.trim(colDataFieldArray[i]), dataField: colStr, cellsrenderer: cellsrenderer , align : ‘center’, cellsalign:’center’, width: 150});

    and how can we give different properties for different coloumns i.e, different width for each coloumn. as per your code all coloumns will get same properties, i also want to add hidden coloumns.

    pls help..

    thanks


    Nagoor
    Participant

    hi peter,

    actually the issue is , in your example data for the grid and jqxdropdown are associated. data for the dropdown is populated from the datafield fron the same local data. but in my case grid data and dropdown data are entirely different. how can i populate values in an array which is independent of grid data(and datafields) into jqxdropdown. the datafield for which i have to implement dropdown have no data in local data, infact its not a datafield of that local data. and pls let me know the significance of display member in coloumn definition. and is there any way i can restrict this event to single click instead of double click.

    thanks


    Nagoor
    Participant

    hi Peter,

    thanks for reply and i implemented the same with my requirement, but am facing some problems.

    i defined the function as

    var getEditorDataAdapter = function (datafield) {

    alert(“we are in editor”);
    var source =
    {
    localdata: servicesArray,
    datatype: “array”,
    datafields:
    [
    { name: ‘service’, type: ‘string’ },

    ]
    };
    var dataAdapter = new $.jqx.dataAdapter(source);
    return dataAdapter;
    }

    and in services array i have data like “one”,”two”

    using this i am getting no error but the values are not getting displayed in dropdown, only two check boxes were visible.

    i tried it by giving json data as..

    var getEditorDataAdapter = function (datafield) {

    alert(“we are in editor”);
    var source =
    {
    localdata: data,
    datatype: “json”,
    datafields:
    [
    { name: ‘service’, type: ‘string’ },

    ]
    };
    var dataAdapter = new $.jqx.dataAdapter(source, { uniqueDataFields: [datafield] });
    return dataAdapter;
    }

    and in data i have [{“service:[“one”,”two”]”}]

    by doing so.. its throwing error.

    pls help me.

    thanks


    Nagoor
    Participant

    thanks..


    Nagoor
    Participant

    Hi peter,

    Thanks for your quick reply. its working fine

    Thanks


    Nagoor
    Participant

    hi peter,

    i a using check boxes as separate coloumn in grid. i am exporting the grid data to excel and am getting the value of
    checkbox (true / false)also.

    how can i export data to excel excluding the checkbox values.

    pls help me with this.

Viewing 11 posts - 16 through 26 (of 26 total)