jQWidgets Forums

Forum Replies Created

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

  • samratsaha2
    Participant

    Hi Dimitar, select event calls renderSecondDropDown method multiple time. in your example , you have used jqxComboBox instead of jqxDropdownList, does it make any deference?


    samratsaha2
    Participant

    Thanks Dimitar,
    do I have to create two different data source or dropdown datasource should be associated with grid datasource, can you pls give a example code /snippet to give an idea.

    in reply to: Nex/Prev button for a jqxGrid Nex/Prev button for a jqxGrid #76538

    samratsaha2
    Participant

    Thanks a lot! will try and let you know


    samratsaha2
    Participant

    I found the solution,

    I have changed the logic to set hidden property as below – works fine!
    But one recommendation,

    even if I set hidden : false should not break the UI , I understand that is default hidden is false still if user want to specify hidden : false should not break the UI .

    $(xmlDoc).find(‘COLUMN’).each( function (){
    datafields.push({name : $(this).attr(‘datafield’), map: ‘m\\:properties>d\\:’+$(this).attr(‘datafield’), type: $(this).attr(‘type’) } );
    if($(this).attr(‘hide’) == ‘false’){
    columns.push({text : $(this).text(), datafield : $(this).attr(‘datafield’), width : $(this).attr(‘width’) });
    }else{
    columns.push({text : $(this).text(), datafield : $(this).attr(‘datafield’), width : $(this).attr(‘width’), hidden : true });
    }
    });

    in reply to: Dynamic columns and datafields Dynamic columns and datafields #76352

    samratsaha2
    Participant

    Here is an example how to accomplish in XML

    <!DOCTYPE html>
    <html lang=”en”>
    <head>
    <link rel=”stylesheet” href=”../../jqwidgets/styles/jqx.base.css” type=”text/css” />
    <script type=”text/javascript” src=”../../scripts/jquery-1.10.2.min.js”></script>
    <script type=”text/javascript” src=”../../jqwidgets/jqxcore.js”></script>
    <script type=”text/javascript” src=”../../jqwidgets/jqxbuttons.js”></script>
    <script type=”text/javascript” src=”../../jqwidgets/jqxscrollbar.js”></script>
    <script type=”text/javascript” src=”../../jqwidgets/jqxmenu.js”></script>
    <script type=”text/javascript” src=”../../jqwidgets/jqxgrid.js”></script>
    <script type=”text/javascript” src=”../../jqwidgets/jqxgrid.selection.js”></script>
    <script type=”text/javascript” src=”../../jqwidgets/jqxgrid.columnsresize.js”></script>
    <script type=”text/javascript” src=”../../jqwidgets/jqxdata.js”></script>
    <script type=”text/javascript”>
    $(document).ready(function () {
    var customersData = ‘<?xml version=”1.0″?><REQUEST><COLUMN_HEADERS><COLUMN datafield=”NAME” type=”string”>Customer Name</COLUMN><COLUMN datafield=”GEOCODE_MATCH” type=”string”>Geocode Match</COLUMN><COLUMN datafield=”HOUSE” type=”string”>House #</COLUMN><COLUMN datafield=”STREET” type=”string”>Street Name</COLUMN><COLUMN datafield=”CITY” type=”string”>City</COLUMN><COLUMN datafield=”STATE” type=”string”>State</COLUMN><COLUMN datafield=”ZIP_CD” type=”string”>Zip Code</COLUMN></COLUMN_HEADERS><CUSTOMERS><CUSTOMER><NAME>NORTH WEST COMMUNICATIONS</NAME><GEOCODE_MATCH>M</GEOCODE_MATCH><HOUSE>7664</HOUSE><STREET>OLD AUBURN RD BLD B</STREET><CITY>CITRUS HEIGHTS</CITY><STATE>CA</STATE><ZIP_CD>95610-3831</ZIP_CD></CUSTOMER><CUSTOMER><NAME>SAMRAT COMMUNICATIONS</NAME><GEOCODE_MATCH>U</GEOCODE_MATCH><HOUSE>7664</HOUSE><STREET>OLD FARM</STREET><CITY>CITRUS HEIGHTS</CITY><STATE>CA</STATE><ZIP_CD>95610-3831</ZIP_CD></CUSTOMER></CUSTOMERS></REQUEST>’;
    var xmlDoc = $.parseXML(customersData);

    var columns = new Array();
    var datafields = new Array();

    $(xmlDoc).find(‘COLUMN’).each( function (){
    datafields.push({name : $(this).attr(‘datafield’), map: ‘m\\:properties>d\\:’+$(this).attr(‘datafield’), type: $(this).attr(‘type’) } );
    columns.push({text : $(this).text(), datafield : $(this).attr(‘datafield’) });
    });

    var source =
    {
    datatype: “xml”,
    datafields: datafields,
    root: “CUSTOMERS”,
    record: “CUSTOMER”,
    id: ‘m\\:properties>d\\:NAME’,
    localdata: customersData
    };
    var dataAdapter = new $.jqx.dataAdapter(source);
    $(“#jqxgrid”).jqxGrid(
    {
    width: 800,
    source: dataAdapter,
    columnsresize: true,
    columns: columns
    });
    });
    </script>
    </head>
    <body class=’default’>
    <div id=’jqxWidget’ style=”font-size: 13px; font-family: Verdana; float: left;”>
    <div id=”jqxgrid”>
    </div>
    </div>
    </body>
    </html>


    samratsaha2
    Participant

    The below code worked fine :

    $(“#fl_address”).jqxInput({ placeHolder: “Enter an Address”, height: 25, theme: theme,
    source: function (query, response) {
    var dataAdapter = new $.jqx.dataAdapter
    (
    {
    datatype: “json”,
    datafields:
    [

    { name: ‘address’},
    { name: ‘latitude’, type: ‘float’ },
    { name: ‘longitude’, type: ‘float’ }

    ],
    //url: “http://10.208.43.124:8983/solr/core1/select”,
    url: “${pageContext.request.contextPath}/auto/getAddress”,
    data:
    {
    wt: “jsonp”,
    indent: “true”,
    queryString:query,
    city:$(“#fl_city”).val(),
    state:$(“#fl_state”).val(),
    zip:$(“#fl_zip”).val(),
    country:$(“#fl_country”).val()
    }
    },
    {
    autoBind: true,
    loadComplete: function (data) {
    if(data.length > 0){
    response($.map(data, function (item) {
    return {
    label: item.address,
    value: item.latitude + “:” + item.longitude

    }
    }))
    }}
    })
    }
    }).on(‘select’, function (event) {
    var item = event.args;
    var longitude = item.value.split(“:”)[1];
    var latitude = item.value.split(“:”)[0];

    $(“#fl_address”).val(item.label);
    ……………….

    Thanks for all help 🙂


    samratsaha2
    Participant

    I tried, but below error I am getting,

    Uncaught TypeError: Cannot read property ‘item’ of undefined
    update?locationID=6613&locationTypeID=135:623 Uncaught TypeError: Cannot read property ‘value’ of undefinedupdate?locationID=6613&locationTypeID=135:623 (anonymous function)jquery-1.11.1.min.js:3 m.event.dispatchjquery-1.11.1.min.js:3 m.event.add.r.handlejquery-1.11.1.min.js:3 m.event.triggerjquery-1.11.1.min.js:3 (anonymous function)jquery-1.11.1.min.js:2 m.extend.eachjquery-1.11.1.min.js:2 m.fn.m.eachjquery-1.11.1.min.js:3 m.fn.extend.triggerjqxinput.js:7 a.extend._raiseEventjqxinput.js:7 a.extend.selectjqxinput.js:7 a.extend.clickjquery-1.11.1.min.js:2 m.extend.proxy.m.isFunction.ejquery-1.11.1.min.js:3 m.event.dispatchjquery-1.11.1.min.js:3 m.event.add.r.handle

    here is my modified code,

    $(“#fl_address”).jqxInput({ placeHolder: “Enter a Address”, displayMember: “address”, valueMember: “latitude”+”:”+”longitude”, height: 25, width: 200, theme: theme,
    source: function (query, response) {
    var dataAdapter = new $.jqx.dataAdapter
    (
    {
    datatype: “json”,
    datafields:
    [

    { name: ‘address’},
    { name: ‘latitude’},
    { name: ‘longitude’}

    ],
    //url: “http://10.208.43.124:8983/solr/core1/select”,
    url: “${pageContext.request.contextPath}/auto/getAddress”,
    data:
    {
    wt: “json”,
    indent: “true”,
    queryString:”ADDR:”+query+”*”,
    city:” +CITY:”+$(“#fl_city”).val(),
    state:” +STATE:”+$(“#fl_state”).val()

    }
    },
    {
    autoBind: true,
    loadComplete: function (data) {
    response($.map(data, function (item) {
    return {
    label: item.address,
    value: item.address
    }
    }));
    }
    }
    );
    }
    });

    $(“#fl_address”).on(‘select’, function (event) {
    var item = event.args.item;
    alert(“value”+item.value);

    });

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