jQWidgets Forums

Forum Replies Created

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts

  • sureshatpure
    Participant

    Hi Dimitar,
    Anyway will check out your code and update ( as you had said i am not storing the status id’s in any other column )

    Meanwhile,You can see that i use the following code to update the dropdown with Statusname along with their id’s
    Which is fetched from the database using this function
    geturl=base_url + "dailyactivity/getldstatus";
    which gives me the result array as

    statusid statusname
    ======== ==========
    1 Prospect
    2 Met the customer
    3 Credit Assessment
    4 Sample,Trails & Formalities
    5 Enquiry/Offer/Negotiation
    6 Managing And Implementation
    and i bind these values using the below code.

    
    resultsEditorldst: function(row, cellvalue, editor){
       var data = $('#jqxgrid_add').jqxGrid('getrowdata', row);
       var leadid =data.leadid;
      // alert("leadid in resultsEditorldst "+leadid);
       if (leadid!="")
        {
            geturl=base_url + "dailyactivity/getldstatusfor/"+leadid;
        }
        else
        {
            geturl=base_url + "dailyactivity/getldstatus";
            
        }
       var stslist = {
                    datatype: "json",
                    datafields:
                            [
                                {name: 'statusid'},
                                {name: 'statusname'}
                            ],
                    id: 'statusid',
                    root: "statusid",
                    url: geturl,
                    cache: false,
                    async: false
                   
                };
    
                stslistdataAdapter = new $.jqx.dataAdapter(stslist, {
                    autoBind: true,
                    buildSelect: function (suboptions)
                    {
                        
                         console.log(suboptions);
                        var data = new Array();
                        $.each(suboptions, function (id, value)
                        {
                            var stslist = records[i];
                        <strong>    
                            stslist.statusid = list.statusid;
                            stslist.statusname = stslist.statusname;
                       </strong>
                            data.push(stslist);
                        });
                        return data;
                    }
                });
        
        
            editor.jqxDropDownList(
                {
                    source: stslistdataAdapter.records, displayMember: "statusname",autoDropDownHeight: true, valueMember: "statusid",promptText:"Status",selectedIndex:0,placeHolder: 'Select status',renderer: function (index, label, value) 
                        {
                             var option = '<div value="' + value + '">' + label + '</div>';
                               return option;
                        }
                });
    },
    

    sureshatpure
    Participant

    Hi Dimitar,
    i tried adding this code..but i still get the Statusname only in the alert

    id Statusname
    == =========
    1 Prospect
    2 Met the customer
    3 Credit Assessment
    4 Sample,Trails & Formalities
    5 Enquiry/Offer/Negotiation
    6 Managing And Implementation

    {text: 'Status', datafield: 'statusid', width: 150, cellsalign: 'center', cellbeginedit:Results.initResultsEditorldst, initeditor: Results.resultsEditorldst, cellsrenderer: Results.renderUnitsldst,promptText:'Select Status',
                                                            cellvaluechanging: function (row, datafield, columntype, oldvalue, newvalue) 
                                                            {
                                                                
                                                                alert("oldvalue "+oldvalue); alert("newvalue "+newvalue);
    
                                                              //  alert("datafield "+datafield); 
                                                               var sid = $('#jqxgrid_add').jqxGrid('getcellvalue', row, "statusid");
                                                               alert('statusid: ' + sid);
    
                                                                  if (newvalue == 0) {
                                                                        return oldvalue;
                                                                    }
                                                                    else if (newvalue!=oldvalue)
                                                                    {
                                                                       $("#jqxgrid_add").jqxGrid('setcellvalue', row, "leadsubstatusid", "Select Substatus");
                                                                        return newvalue;
                                                                    } 
    
                                                            }
                                            },
    

    sureshatpure
    Participant

    Thanks Dimitar


    sureshatpure
    Participant

    Hi Dimitar,
    the code works fine, i had missed the returning the value in the datafield ‘leadid’, i was returning “No Leads” text only

    old code

    if($activitydetails[$i]["leadid"]==0)
    {
         $row["leadid"] = "No Leads";    
    }
    

    new code

    
    if($activitydetails[$i]["leadid"]==0)
    {
         $row["leadid"] = "No Leads";    
    }
    else
    {
        $row["leadid"] = $activitydetails[$i]["leadid"];
    }

    the leadid’s are loaded from db as desired
    the leadid's loaded


    sureshatpure
    Participant

    Hi Dimitar,
    This is for follow up of the above code, i want to display the leadid’s while loading the grid(jqxgrid_n) of the each if it exists in the database,
    the datafield is ‘leadid’ which has the leadid value or 0.

     $("#jqxgrid").jqxGrid(
                                    {
                                        width: 760,
                                        height: 500,
                                        source: dataAdapter,
                                        theme: 'energyblue',
                                        sortable: true,
                                        pageable: true,
                                        columnsresize: true,
                                        editable: false,
                                        showfilterrow: true,
                                        filterable: true,
                                        autoheight: true,
                                        showtoolbar: true,
                                        pageable: true,
                                        rendertoolbar: toolbarfunc,
                                        columns: [
                                            {text: 'ID', datafield: 'id', width: 60},
                                            {
                                                text: 'Visit Date', datafield: 'currentdate', columntype: 'datetimeinput', width: 110, align: 'left', cellsalign: 'left', cellsformat: 'd', formatString: 'd'
                                                        /* , validation: function (cell, value) {
                                                         if (value == "")
                                                         return true;
                                                         
                                                         var year = value.getFullYear();
                                                         if (year >= 2014) {
                                                         return { result: false, message: "Ship Date should be before 1/1/2014" };
                                                         }
                                                         return true;
                                                         }*/
                                            },
                                            {text: 'User Code', columntype: 'dropdownlist', filterable: 'enable', datafield: 'execode', width: 75},
                                            {text: 'User Name', datafield: 'exename', width: 150, cellsalign: 'left'},
                                            {text: 'Branch', datafield: 'branch', width: 150, cellsalign: 'left'},
                                            {text: 'Created Date', datafield: 'creationdate', columntype: 'datetimeinput', width: 110, align: 'left', cellsalign: 'left', cellsformat: 'd', formatString: 'd'},
                                            {text: 'Update', cellsalign: 'center', datafield: 'Update', filterable: false, width: 100, columntype: 'button', cellsrenderer: function () {
                                                    return "Update";
                                                }, buttonclick: function (row)
                                                { // popup function start
                                                    actionmode = "update";
                                                    var rowindex = $("#jqxgrid").jqxGrid('getselectedrowindex');
                                                    var headerid = $("#jqxgrid").jqxGrid('getcellvalue', rowindex, 'id');
                                                    header_date = $("#jqxgrid").jqxGrid('getcellvalue', rowindex, 'currentdate');
                                                    username = $("#jqxgrid").jqxGrid('getcellvalue', rowindex, 'exename');
                                                    branch = $("#jqxgrid").jqxGrid('getcellvalue', rowindex, 'branch');
    
                                                    dhdr_headerid = headerid;
    
                                                    $('#username').jqxInput('val', username);
                                                    $('#branch').jqxInput('val', branch);
    
                                                    var t = $('#hdn_hdr_id').val();
    
                                                    $('#hdn_hdr_id').val(dhdr_headerid);
                                                    var g = $('#hdn_hdr_id').val();
    
                                                    var rows = new Array();
                                                    var columns = new Array();
                                                    jQuery.ajax({
                                                        dataType: "html",
                                                        url: 'dailyactivity/get_edit_data/' + headerid,
                                                        type: "POST",
                                                        async: false,
                                                        error: function (xhr, status) {
                                                            alert("check " + status + " test");
                                                        },
                                                        success: function (result) {
                                                            var obj = jQuery.parseJSON(result);
                                                            columns = obj[0].columns;
                                                            rows = obj[1].rows;
    
                                                            commonCols = obj[0].columns;
                                                        }
                                                    });
    
                                                    var source =
                                                            {
                                                                datatype: "json",
                                                                datafields: [],
                                                                id: 'id',
                                                                localdata: rows
                                                            };
    
                                                    var dataAdapter = new $.jqx.dataAdapter(source);
                                                    header_date = convert(header_date);
    
                                                    $('#update_header_date').jqxInput({width: '100px', height: '25px', disabled: true});
    
                                                    $('#update_header_date').val(header_date);
    
                                                    $("#jqxgrid_n").jqxGrid(
                                                            {
                                                                width: '100%',
                                                                height: 300,
                                                                source: dataAdapter,
                                                                theme: 'energyblue',
                                                                columnsresize: true,
                                                                selectionmode: 'rowselect',
                                                                editable: true,
                                                                editmode: 'click',
                                                                sortable: true,
                                                                pageable: true,
                                                                columnsresize: true,
                                                                sortable: true,
                                                                showfilterrow: false,
                                                                filterable: true,
                                                                columns: [
                                                                    {text: 'UID', datafield: 'id', width: 150, cellsalign: 'left', hidden: true},
                                                                    {text: 'Customer Group', datafield: 'custgroup', width: 150, editable: false},
                                                                    {text: 'Product Group', datafield: 'itemgroup', width: 150, cellsalign: 'left', editable: false},
                                                                    {text: 'Lead id', datafield: 'leadid', displayfield: 'leadid', width: 127, cellsalign: 'center', cellbeginedit: Resultsupdate.initResultsEditor, initeditor: Resultsupdate.resultsEditor, cellsrenderer: Resultsupdate.renderUnits,promptText:'Select Leadid',cellvaluechanging: function (row, datafield, columntype, oldvalue, newvalue) 
                                                                            {
                                                                               // alert("oldvalue "+oldvalue); alert("newvalue "+newvalue);
                                                                                  if (newvalue == 0) {
                                                                                   return oldvalue;
                                                                              }
                                                                            }
                                                                    },
                                                                    {text: 'noofleads', datafield: 'noofleads',hidden:true, width: 20, cellsalign: 'left', editable: false},
                                                                    {text: 'result_type', datafield: 'result_type',hidden:true, width: 75, cellsalign: 'left', editable: false},
    
                                                                    {text: 'Activity Type', datafield: 'subactivity', width: 110, cellsalign: 'left', cellbeginedit:Resultsupdate.initResultsEditorat, initeditor: Resultsupdate.resultsEditorat, cellsrenderer: Resultsupdate.renderUnitsat
                                                                    },
                                                                    
                                                                    {text: 'Potential', datafield: 'potentialqty', width: 75, cellsalign: 'left', editable: false},
    
                                                                    {text: 'Required Quantity', datafield: 'quantity', width: 75, cellsalign: 'left',
                                                                            cellbeginedit: function (row, datafield, columntype) {
                                                                                        var rowdata = $("#jqxgrid_n").jqxGrid('getrowdata', row);
                                                                                        var leadid = rowdata.leadid;
                                                                                       // alert("leadid in quantity cell rendering "+leadid);
                                                                                        if(leadid==undefined || leadid==0)
                                                                                        {
                                                                                            return true;
                                                                                        }
                                                                                        else
                                                                                        {
                                                                                            return false;
                                                                                        }
    
                                                                                    }
                                                                        },
                                                                        {text: 'Sales Type', datafield: 'division', width: 110, cellsalign: 'left',readonly:true,cellbeginedit:Resultsupdate.initResultsEditorst, initeditor: Resultsupdate.resultsEditorst, cellsrenderer: Resultsupdate.renderUnitsst
    
                                                                        },
                                                                    
                                                                       
                                                                    /*{text: 'Mode of Contact', datafield: 'modeofcontact', width: 100, cellsalign: 'left', columntype: 'dropdownlist',
                                                                        createeditor: function (row, cellvalue, editor) {
                                                                            editor.jqxDropDownList({source: ["E-mail", "Phone", "Visit"]});
                                                                        }
                                                                    },*/
                                                                    {text: 'Mode of Contact', datafield: 'modeofcontact', width: 100, cellsalign: 'left', cellbeginedit:Resultsupdate.initResultsEditorcon, createeditor: Resultsupdate.resultsEditorcon, cellsrenderer: Resultsupdate.renderUnitsst
                                                                    },
                                                                    {text: 'Time Spent (Hrs)', datafield: 'hour_s', width: 75, cellsalign: 'left', columntype: 'dropdownlist',
                                                                        createeditor: function (row, cellvalue, editor) {
                                                                            editor.jqxDropDownList({source: ["00 Hr", "01 Hrs", "02 Hrs", "03 Hrs", "04 Hrs", "05 Hrs", "06 Hrs", "07 Hrs", "08 Hrs", "09 Hrs", "10 Hrs"]});
                                                                        }
                                                                    },
                                                                    {text: 'Time Spent (Mins)', datafield: 'minit', width: 75, cellsalign: 'left', columntype: 'dropdownlist',
                                                                        createeditor: function (row, cellvalue, editor) {
                                                                            editor.jqxDropDownList({source: ["0 mins", "5 mins", "10 mins", " 15 mins", "20 mins", "25 mins", "30 mins", " 35 mins", "40 mins", "45 mins", " 50 mins", "55 mins"]});
                                                                        }
                                                                    },
                                                                {text: 'Notes / Remarks', datafield: 'remarks', width: 150, cellsalign: 'left'},
    
                                                                ]
                                                            });
                                                    
                                                var x = ($(window).width() - $("#customWindow").jqxWindow('width')) / 2 + $(window).scrollLeft();
                                                var y = ($(window).height() - $("#customWindow").jqxWindow('height')) / 2 + $(window).scrollTop();
                                                $("#customWindow").jqxWindow({ position: { x: x, y: y} });
                                                    $('#customWindow').jqxWindow('open');
                                                    $('#customWindow').jqxWindow({width: "100%"});
    
                                                } // end of popup edit button click event
                                            },
                                        ]
    
                                    });
    

    inserting images for your references in order the order how i want it to be

    This is how it loads by default (no leadid is loaded even if the leadid present in the database)

    How it loads as default

    Loads the leadid, only when we click on that particular cell

    Loads only when we click

    This is how i am trying to load

    This is what i am trying to do


    sureshatpure
    Participant

    Thanks Dimitar, yes worked fine..as per your suggestion, was missing the div tag.


    sureshatpure
    Participant

    Hi Dimitar,
    i have one more issue related to display
    the leadid’s are not displayed in the chrome browser
    below is the reference image for chrome, you can see the size of dropdown is list for two leadid’s but not visible

    the leadid's are not displayed in the dropdown list for chrome</p>

    Where as in firefox,you can see the difference, the leadid’s are displayed in the dropdown list

    the leadid's are displayed in the dropdown list for firefox</p>

    i guess, is it related to async or cache property..?


    sureshatpure
    Participant

    Thanks Dimitar, yes worked fine..as per your suggestion.


    sureshatpure
    Participant

    Hi sushengloong,

    I am also looking for a solution as yours.i have a two dropdownlist in a grid, status and substatus, i want load the substatus values based on the changed status in the first dropdownlist. Did you find a solution, can you please help me out.


    sureshatpure
    Participant

    Hello Lalit Singh,

    I am also looking for the same solution as yours, i have a two dropdownlist in a grid, status and substatus, i want load the substatus values based on the changed status in the first dropdownlist.

Viewing 10 posts - 1 through 10 (of 10 total)